From f66c1939e22d3f2a978b8340f2982f3c5e5500fc Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 20 Oct 2021 19:31:13 +0200 Subject: [PATCH] fix other reloadchannels segfault with getepgid Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/a0e658ddcff275d4107e7e2c356ea30aafc59899 Author: Jacek Jendrzej Date: 2021-10-20 (Wed, 20 Oct 2021) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/eitd/xmlutil.cpp | 8 ++++++-- src/zapit/include/zapit/bouquets.h | 3 ++- src/zapit/src/zapit.cpp | 7 +++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/eitd/xmlutil.cpp b/src/eitd/xmlutil.cpp index aa009b92d..c47f9578d 100644 --- a/src/eitd/xmlutil.cpp +++ b/src/eitd/xmlutil.cpp @@ -564,10 +564,12 @@ t_channel_id getepgid(std::string epg_name) if (m == CZapitClient::MODE_RADIO) 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()) continue; @@ -576,6 +578,8 @@ t_channel_id getepgid(std::string epg_name) { if (match_found) { + if(g_bouquetManager->empty) + break; if ((*cit)->getEpgID() == epgid) continue; (*cit)->setEPGid(epgid); } diff --git a/src/zapit/include/zapit/bouquets.h b/src/zapit/include/zapit/bouquets.h index c9597e11b..709a5c925 100644 --- a/src/zapit/include/zapit/bouquets.h +++ b/src/zapit/include/zapit/bouquets.h @@ -122,8 +122,9 @@ class CBouquetManager : public OpenThreads::Thread bool logo_running; std::list LogoList; public: - CBouquetManager() { remainChannels = NULL; logo_running = false; }; + CBouquetManager() { remainChannels = NULL; logo_running = false; empty = false; }; ~CBouquetManager(); + bool empty; class ChannelIterator { private: diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index 5a1735041..aca3a222e 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -1180,15 +1180,18 @@ bool CZapit::PrepareChannels() { current_channel = 0; - if (!CServiceManager::getInstance()->LoadServices(false)) + g_bouquetManager->empty = true; + if (!CServiceManager::getInstance()->LoadServices(false)){ + g_bouquetManager->empty = false; return false; - + } INFO("LoadServices: success"); if(CNeutrinoApp::getInstance()->channelList) CNeutrinoApp::getInstance()->channelList->ClearChannelList(); g_bouquetManager->loadBouquets(); + g_bouquetManager->empty = false; /* save if services changed (update from sdt, etc) */ CServiceManager::getInstance()->SaveServices(true, true); return true;