CNeutrinoEventList::findEvents -fix segfault if Bouquets not in current mode, remove unique sort

Origin commit data
------------------
Branch: ni/coolstream
Commit: 8079c9126b
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2013-05-16 (Thu, 16 May 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2013-05-16 10:21:45 +02:00
parent b828f9db70
commit 3cc3eec0ed

View File

@@ -65,6 +65,11 @@ bool sortById (const CChannelEvent& a, const CChannelEvent& b)
{ {
return a.eventID < b.eventID ; 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 #endif
inline bool sortByDescription (const CChannelEvent& a, const CChannelEvent& b) 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; 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() CNeutrinoEventList::CNeutrinoEventList()
{ {
frameBuffer = CFrameBuffer::getInstance(); frameBuffer = CFrameBuffer::getInstance();
@@ -1075,6 +1075,7 @@ bool CNeutrinoEventList::findEvents(void)
std::map<t_channel_id, t_channel_id>::iterator map_it; std::map<t_channel_id, t_channel_id>::iterator map_it;
CChannelEventList::iterator e; CChannelEventList::iterator e;
if(!evtlist.empty()){
for ( e=evtlist.begin(); e!=evtlist.end();){ for ( e=evtlist.begin(); e!=evtlist.end();){
map_it = ch_id_map.find(e->channelID); map_it = ch_id_map.find(e->channelID);
if (map_it != ch_id_map.end()){ if (map_it != ch_id_map.end()){
@@ -1085,11 +1086,12 @@ bool CNeutrinoEventList::findEvents(void)
evtlist.erase(e);// remove event for not found channels in channelList evtlist.erase(e);// remove event for not found channels in channelList
} }
} }
}
box.hide(); box.hide();
} }
if(!evtlist.empty()){ if(!evtlist.empty()){
sort(evtlist.begin(),evtlist.end(),sortByDateTime); sort(evtlist.begin(),evtlist.end(),sortByDateTime);
evtlist.erase(unique(evtlist.begin(), evtlist.end(),sortbyEventid), evtlist.end());
} }
current_event = (unsigned int)-1; current_event = (unsigned int)-1;
@@ -1292,7 +1294,7 @@ int CEventFinderMenu::showMenu(void)
} }
else if(*m_search_list == CNeutrinoEventList::SEARCH_LIST_BOUQUET) 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();; *m_search_bouquet_id = bouquetList->getActiveBouquetNumber();;
} }
if(!bouquetList->Bouquets.empty()) if(!bouquetList->Bouquets.empty())
@@ -1342,9 +1344,14 @@ bool CEventFinderMenu::changeNotify(const neutrino_locale_t OptionName, void *)
} }
else if (*m_search_list == CNeutrinoEventList::SEARCH_LIST_BOUQUET) else if (*m_search_list == CNeutrinoEventList::SEARCH_LIST_BOUQUET)
{ {
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 = bouquetList->Bouquets[*m_search_bouquet_id]->channelList->getName();
m_search_channelname_mf->setActive(true); m_search_channelname_mf->setActive(true);
} }
}
else if (*m_search_list == CNeutrinoEventList::SEARCH_LIST_ALL) else if (*m_search_list == CNeutrinoEventList::SEARCH_LIST_ALL)
{ {
m_search_channelname = ""; m_search_channelname = "";