From 36b14e31ef0bcf2571e882609f2a5eefc011d775 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 26 Nov 2014 10:45:29 +0300 Subject: [PATCH] gui/channellist.cpp: bug fix, default copy constructor is danger, if class have pointers --- src/gui/channellist.cpp | 1 - src/gui/channellist.h | 1 + src/neutrino.cpp | 6 ++---- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index e1bd25d51..8e2d84f7e 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -119,7 +119,6 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl CChannelList::~CChannelList() { - chanlist->clear(); if(dline){ delete dline; dline = NULL; diff --git a/src/gui/channellist.h b/src/gui/channellist.h index 964aa0a81..6f9102ec5 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -236,6 +236,7 @@ public: SORT_MAX }; unsigned Size() { return (*chanlist).size(); } + ZapitChannelList &getChannels() { return channels; }; }; #endif diff --git a/src/neutrino.cpp b/src/neutrino.cpp index afff882d1..cc3efef22 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1363,13 +1363,11 @@ void CNeutrinoApp::channelsInit(bool bOnly) TVallList = new CBouquetList(g_Locale->getText(LOCALE_CHANNELLIST_HEAD)); tmp = TVallList->addBouquet(g_Locale->getText(LOCALE_CHANNELLIST_HEAD)); - delete tmp->channelList; - tmp->channelList = new CChannelList(*TVchannelList); + tmp->channelList->SetChannelList(&TVchannelList->getChannels()); RADIOallList = new CBouquetList(g_Locale->getText(LOCALE_CHANNELLIST_HEAD)); tmp = RADIOallList->addBouquet(g_Locale->getText(LOCALE_CHANNELLIST_HEAD)); - delete tmp->channelList; - tmp->channelList = new CChannelList(*RADIOchannelList); + tmp->channelList->SetChannelList(&RADIOchannelList->getChannels()); if(TVsatList) delete TVsatList; TVsatList = new CBouquetList(g_Locale->getText(LOCALE_CHANNELLIST_SATS));