From a2b01a5f320ac6098906c9fe63146961656f13fb Mon Sep 17 00:00:00 2001 From: jmarshallnz Date: Wed, 21 May 2014 07:42:54 +1200 Subject: [PATCH] Merge pull request #4751 from fritsch/pvr-fix EpgContainer: Fix Deadlock when calling Observer with lock --- xbmc/epg/EpgContainer.cpp | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/xbmc/epg/EpgContainer.cpp b/xbmc/epg/EpgContainer.cpp index 68d23c9..d2bc48f 100644 --- a/xbmc/epg/EpgContainer.cpp +++ b/xbmc/epg/EpgContainer.cpp @@ -670,32 +670,31 @@ bool CEpgContainer::CheckPlayingEvents(void) { bool bReturn(false); time_t iNow; - CSingleLock lock(m_critSection); + bool bFoundChanges(false); - CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(iNow); - if (iNow >= m_iNextEpgActiveTagCheck) { - bool bFoundChanges(false); CSingleLock lock(m_critSection); - - for (map::iterator it = m_epgs.begin(); it != m_epgs.end(); it++) - bFoundChanges = it->second->CheckPlayingEvent() || bFoundChanges; - CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(m_iNextEpgActiveTagCheck); - m_iNextEpgActiveTagCheck += g_advancedSettings.m_iEpgActiveTagCheckInterval; - - if (bFoundChanges) + CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(iNow); + if (iNow >= m_iNextEpgActiveTagCheck) { - SetChanged(); - NotifyObservers(ObservableMessageEpgActiveItem); - } + for (map::iterator it = m_epgs.begin(); it != m_epgs.end(); it++) + bFoundChanges = it->second->CheckPlayingEvent() || bFoundChanges; + CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(m_iNextEpgActiveTagCheck); + m_iNextEpgActiveTagCheck += g_advancedSettings.m_iEpgActiveTagCheckInterval; - /* pvr tags always start on the full minute */ - if (g_PVRManager.IsStarted()) - m_iNextEpgActiveTagCheck -= m_iNextEpgActiveTagCheck % 60; + /* pvr tags always start on the full minute */ + if (g_PVRManager.IsStarted()) + m_iNextEpgActiveTagCheck -= m_iNextEpgActiveTagCheck % 60; - bReturn = true; + bReturn = true; + } } + if (bFoundChanges) + { + SetChanged(); + NotifyObservers(ObservableMessageEpgActiveItem); + } return bReturn; } -- 2.7.4