From 3cc3eec0ed66508772fd782bafbf5c9825558c17 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 16 May 2013 10:21:45 +0200 Subject: [PATCH] CNeutrinoEventList::findEvents -fix segfault if Bouquets not in current mode, remove unique sort Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/8079c9126b1e6b3b8e7d0ce1cec3df578196ef2c Author: Jacek Jendrzej Date: 2013-05-16 (Thu, 16 May 2013) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/eventlist.cpp | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 2263b8582..d3b959879 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -65,6 +65,11 @@ bool sortById (const CChannelEvent& a, const CChannelEvent& b) { return a.eventID < b.eventID ; } + +inline static bool sortbyEventid (const CChannelEvent& a, const CChannelEvent& b) +{ + return (a.channelID == b.channelID && a.eventID == b.eventID && a.startTime == b.startTime); +} #endif inline bool sortByDescription (const CChannelEvent& a, const CChannelEvent& b) { @@ -78,11 +83,6 @@ inline static bool sortByDateTime (const CChannelEvent& a, const CChannelEvent& return a.startTime < b.startTime; } -inline static bool sortbyEventid (const CChannelEvent& a, const CChannelEvent& b) -{ - return (a.channelID == b.channelID && a.eventID == b.eventID && a.startTime == b.startTime); -} - CNeutrinoEventList::CNeutrinoEventList() { frameBuffer = CFrameBuffer::getInstance(); @@ -1075,21 +1075,23 @@ bool CNeutrinoEventList::findEvents(void) std::map::iterator map_it; CChannelEventList::iterator e; - for ( e=evtlist.begin(); e!=evtlist.end();){ - map_it = ch_id_map.find(e->channelID); - if (map_it != ch_id_map.end()){ - e->channelID = map_it->second;//map channelID48 to channelID - ++e; - } - else{ - evtlist.erase(e);// remove event for not found channels in channelList + if(!evtlist.empty()){ + for ( e=evtlist.begin(); e!=evtlist.end();){ + map_it = ch_id_map.find(e->channelID); + if (map_it != ch_id_map.end()){ + e->channelID = map_it->second;//map channelID48 to channelID + ++e; + } + else{ + evtlist.erase(e);// remove event for not found channels in channelList + } } } + box.hide(); } if(!evtlist.empty()){ sort(evtlist.begin(),evtlist.end(),sortByDateTime); - evtlist.erase(unique(evtlist.begin(), evtlist.end(),sortbyEventid), evtlist.end()); } current_event = (unsigned int)-1; @@ -1292,7 +1294,7 @@ int CEventFinderMenu::showMenu(void) } else if(*m_search_list == CNeutrinoEventList::SEARCH_LIST_BOUQUET) { - if(bouquetList->Bouquets.size()<*m_search_bouquet_id ){ + if(bouquetList->Bouquets.size() < *m_search_bouquet_id ){ *m_search_bouquet_id = bouquetList->getActiveBouquetNumber();; } if(!bouquetList->Bouquets.empty()) @@ -1342,8 +1344,13 @@ bool CEventFinderMenu::changeNotify(const neutrino_locale_t OptionName, void *) } else if (*m_search_list == CNeutrinoEventList::SEARCH_LIST_BOUQUET) { - m_search_channelname = bouquetList->Bouquets[*m_search_bouquet_id]->channelList->getName(); - m_search_channelname_mf->setActive(true); + if(bouquetList->Bouquets.size() < *m_search_bouquet_id ){ + *m_search_bouquet_id = bouquetList->getActiveBouquetNumber(); + } + if(!bouquetList->Bouquets.empty()){ + m_search_channelname = bouquetList->Bouquets[*m_search_bouquet_id]->channelList->getName(); + m_search_channelname_mf->setActive(true); + } } else if (*m_search_list == CNeutrinoEventList::SEARCH_LIST_ALL) {