diff options
-rw-r--r-- | epgsearch.cpp | 12 | ||||
-rw-r--r-- | epgsearch.h | 8 | ||||
-rw-r--r-- | pages/whats_on.ecpp | 6 |
3 files changed, 13 insertions, 13 deletions
diff --git a/epgsearch.cpp b/epgsearch.cpp index 0b15f10..b157ea0 100644 --- a/epgsearch.cpp +++ b/epgsearch.cpp @@ -576,20 +576,18 @@ SearchResult::SearchResult( string const& data ) } } -const cEvent* SearchResult::GetEvent() +const cEvent* SearchResult::GetEvent(const cChannel* Channel) { - /* JJJ: Lock order wrong, fix if function is still used - * Needs to be Timers, Channels, Recordings Schedules in this sequence - */ + if (!Channel) return NULL; + #if VDRVERSNUM >= 20301 LOCK_SCHEDULES_READ; #else cSchedulesLock schedulesLock; const cSchedules* Schedules = cSchedules::Schedules(schedulesLock); -#endif if (!Schedules) return NULL; - const cChannel *Channel = GetChannel(); - if (!Channel) return NULL; +#endif + const cSchedule *Schedule = Schedules->GetSchedule(Channel); if (!Schedule) return NULL; return Schedule->GetEvent(m_eventId); diff --git a/epgsearch.h b/epgsearch.h index 61ae2eb..95d7387 100644 --- a/epgsearch.h +++ b/epgsearch.h @@ -340,12 +340,12 @@ public: time_t TimerStopTime() const { return m_timerstop; } int TimerMode() const { return m_timerMode; } bool operator<( SearchResult const& other ) const { return m_starttime < other.m_starttime; } - const cEvent* GetEvent(); + const cEvent* GetEvent(const cChannel* Channel); - /* JJJ: Should be done with a "Channels" argument to be sure the Lock order - * is correct; or find a better way to do this - */ #if VDRVERSNUM >= 20301 + /* Be careful when calling this function concerning the lock order: + * Timers, Channels, Recordings Schedules + */ const cChannel* GetChannel() { LOCK_CHANNELS_READ; return Channels->GetByChannelID(m_channel); } #else const cChannel* GetChannel() { return Channels.GetByChannelID(m_channel); } diff --git a/pages/whats_on.ecpp b/pages/whats_on.ecpp index 2db13ef..36a8f96 100644 --- a/pages/whats_on.ecpp +++ b/pages/whats_on.ecpp @@ -177,8 +177,10 @@ if (type == "now") { time_t now = time(NULL); for (SearchResults::iterator result = results.begin(); result != results.end(); ++result) { long diff = result->StartTime() - now; - if (labs(diff) >= 24*60*60) continue; // skip broadcasts more than a day away - EpgInfoPtr epgEvent = EpgEvents::CreateEpgInfo(result->GetChannel(), result->GetEvent()); + if (labs(diff) >= 24*60*60) continue; // skip broadcasts more than a day away + const cChannel* Channel = result->GetChannel(); + if (!Channel) continue; + EpgInfoPtr epgEvent = EpgEvents::CreateEpgInfo(Channel, result->GetEvent(Channel)); eventList.push_back(epgEvent); } } |