src/gui/channellist.cpp: use channellist object on stack

Heap not required here.
This commit is contained in:
2018-03-25 15:47:15 +02:00
parent 9dabc6301b
commit 25b99c4c49

View File

@@ -1231,8 +1231,8 @@ int CChannelList::showLiveBouquet(int key)
{
if (this->lastChList.size() > 1)
{
CChannelList * liveList = new CChannelList(g_Locale->getText(LOCALE_CHANNELLIST_HISTORY), true, true);
liveList->setLiveBouquet();
CChannelList liveList(g_Locale->getText(LOCALE_CHANNELLIST_HISTORY), true, true);
liveList.setLiveBouquet();
for (unsigned int i = 1; i < this->lastChList.size(); ++i)
{
@@ -1241,16 +1241,15 @@ int CChannelList::showLiveBouquet(int key)
{
CZapitChannel* channel = getChannel(channel_id);
if (channel)
liveList->addChannel(channel);
liveList.addChannel(channel);
}
}
if (!liveList->isEmpty())
if (!liveList.isEmpty())
{
this->frameBuffer->paintBackground();
res = liveList->exec();
res = liveList.exec();
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
}
delete liveList;
}
else
ShowHint(LOCALE_MESSAGEBOX_INFO, LOCALE_CHANNELLIST_HISTORY_EMPTY);
@@ -1263,15 +1262,15 @@ int CChannelList::showLiveBouquet(int key)
{
bool isRecord = (!autoshift && CNeutrinoApp::getInstance()->recordingstatus);
CChannelList * origList = CNeutrinoApp::getInstance()->channelList;
CChannelList * liveList = new CChannelList(isRecord ? g_Locale->getText(LOCALE_CHANNELLIST_RECORDABLE_CHANNELS) : g_Locale->getText(LOCALE_CHANNELLIST_CURRENT_TP), false, true);
liveList->setLiveBouquet();
CChannelList liveList(isRecord ? g_Locale->getText(LOCALE_CHANNELLIST_RECORDABLE_CHANNELS) : g_Locale->getText(LOCALE_CHANNELLIST_CURRENT_TP), false, true);
liveList.setLiveBouquet();
if (isRecord)
{
for (unsigned int i = 0 ; i < (*origList->chanlist).size(); i++)
{
if (SameTP((*origList->chanlist)[i]))
liveList->addChannel((*origList->chanlist)[i]);
liveList.addChannel((*origList->chanlist)[i]);
}
}
else
@@ -1280,17 +1279,16 @@ int CChannelList::showLiveBouquet(int key)
for (unsigned int i = 0; i < (*origList->chanlist).size(); i++)
{
if (((*origList->chanlist)[i]->getChannelID() >> 16) == recid)
liveList->addChannel((*origList->chanlist)[i]);
liveList.addChannel((*origList->chanlist)[i]);
}
}
if (!liveList->isEmpty())
if (!liveList.isEmpty())
{
liveList->adjustToChannelID(origList->getActiveChannel_ChannelID());
liveList.adjustToChannelID(origList->getActiveChannel_ChannelID());
this->frameBuffer->paintBackground();
res = liveList->exec();
res = liveList.exec();
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
}
delete liveList;
return res;
}