From 25b99c4c494899a6dc624d5045d6e8c3ffc6fffe Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 25 Mar 2018 15:47:15 +0200 Subject: [PATCH] src/gui/channellist.cpp: use channellist object on stack Heap not required here. --- src/gui/channellist.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 861c95d3b..b3aab34d4 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -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; }