fix other reloadchannels segfault with getepgid

This commit is contained in:
Jacek Jendrzej
2021-10-20 16:35:40 +02:00
parent c806c8317a
commit ede935bdce
3 changed files with 13 additions and 5 deletions

View File

@@ -564,10 +564,12 @@ t_channel_id getepgid(std::string epg_name)
if (m == CZapitClient::MODE_RADIO) if (m == CZapitClient::MODE_RADIO)
cit = g_bouquetManager->radioChannelsBegin(); cit = g_bouquetManager->radioChannelsBegin();
for (; !(cit.EndOfChannels()); cit++) for (; g_bouquetManager->empty || !(cit.EndOfChannels()); cit++)
{ {
std::string tvg_id = (*cit)->getEPGmap(); if(g_bouquetManager->empty)
break;
std::string tvg_id = (*cit)->getEPGmap();
if (tvg_id.empty()) if (tvg_id.empty())
continue; continue;
@@ -576,6 +578,8 @@ t_channel_id getepgid(std::string epg_name)
{ {
if (match_found) if (match_found)
{ {
if(g_bouquetManager->empty)
break;
if ((*cit)->getEpgID() == epgid) continue; if ((*cit)->getEpgID() == epgid) continue;
(*cit)->setEPGid(epgid); (*cit)->setEPGid(epgid);
} }

View File

@@ -122,8 +122,9 @@ class CBouquetManager : public OpenThreads::Thread
bool logo_running; bool logo_running;
std::list<t_channel_id> LogoList; std::list<t_channel_id> LogoList;
public: public:
CBouquetManager() { remainChannels = NULL; logo_running = false; }; CBouquetManager() { remainChannels = NULL; logo_running = false; empty = false; };
~CBouquetManager(); ~CBouquetManager();
bool empty;
class ChannelIterator class ChannelIterator
{ {
private: private:

View File

@@ -1180,15 +1180,18 @@ bool CZapit::PrepareChannels()
{ {
current_channel = 0; current_channel = 0;
if (!CServiceManager::getInstance()->LoadServices(false)) g_bouquetManager->empty = true;
if (!CServiceManager::getInstance()->LoadServices(false)){
g_bouquetManager->empty = false;
return false; return false;
}
INFO("LoadServices: success"); INFO("LoadServices: success");
if(CNeutrinoApp::getInstance()->channelList) if(CNeutrinoApp::getInstance()->channelList)
CNeutrinoApp::getInstance()->channelList->ClearChannelList(); CNeutrinoApp::getInstance()->channelList->ClearChannelList();
g_bouquetManager->loadBouquets(); g_bouquetManager->loadBouquets();
g_bouquetManager->empty = false;
/* save if services changed (update from sdt, etc) */ /* save if services changed (update from sdt, etc) */
CServiceManager::getInstance()->SaveServices(true, true); CServiceManager::getInstance()->SaveServices(true, true);
return true; return true;