Skip to content

Commit

Permalink
pvr/epg: don't keep a lock in CPVRChannel when doing anything with th…
Browse files Browse the repository at this point in the history
…e EPG table. issue #367
  • Loading branch information
opdenkamp committed Dec 23, 2011
1 parent 6823b92 commit 7e4c4e1
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions xbmc/pvr/channels/PVRChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,26 +156,29 @@ bool CPVRChannel::Delete(void)
if (!database)
return bReturn;

CSingleLock lock(m_critSection);

/* delete the EPG table */
CEpg *epg = g_EpgContainer.GetByChannel(*this);
CEpg *epg = GetEPG();
if (epg)
{
g_EpgContainer.DeleteEpg(*epg, true);
CSingleLock lock(m_critSection);
m_bEPGCreated = false;
}

bReturn = database->Delete(*this);

database->Close();

return bReturn;
}

CEpg *CPVRChannel::GetEPG(void) const
{
return g_EpgContainer.GetByChannel(*this);
CEpg *epg(NULL);
{
CSingleLock lock(m_critSection);
if (!m_bIsHidden && m_bEPGEnabled && m_iEpgId > 0)
epg = g_EpgContainer.GetByChannel(*this);
}
return epg;
}

bool CPVRChannel::UpdateFromClient(const CPVRChannel &channel)
Expand Down Expand Up @@ -691,7 +694,7 @@ bool CPVRChannel::CreateEPG(bool bForce /* = false */)

int CPVRChannel::GetEPG(CFileItemList &results) const
{
CEpg *epg = g_EpgContainer.GetByChannel(*this);
CEpg *epg = GetEPG();
if (!epg)
{
CLog::Log(LOGDEBUG, "PVR - %s - cannot get EPG for channel '%s'",
Expand All @@ -704,8 +707,7 @@ int CPVRChannel::GetEPG(CFileItemList &results) const

bool CPVRChannel::ClearEPG() const
{
CSingleLock lock(m_critSection);
CEpg *epg = g_EpgContainer.GetByChannel(*this);
CEpg *epg = GetEPG();
if (epg)
epg->Clear();

Expand All @@ -714,15 +716,13 @@ bool CPVRChannel::ClearEPG() const

bool CPVRChannel::GetEPGNow(CEpgInfoTag &tag) const
{
CSingleLock lock(m_critSection);
CEpg *epg = !m_bIsHidden && m_bEPGEnabled && m_iEpgId > 0 ? g_EpgContainer.GetByChannel(*this) : NULL;
CEpg *epg = GetEPG();
return epg ? epg->InfoTagNow(tag) : false;
}

bool CPVRChannel::GetEPGNext(CEpgInfoTag &tag) const
{
CSingleLock lock(m_critSection);
CEpg *epg = !m_bIsHidden && m_bEPGEnabled && m_iEpgId > 0 ? g_EpgContainer.GetByChannel(*this) : NULL;
CEpg *epg = GetEPG();
return epg ? epg->InfoTagNext(tag) : false;
}

Expand Down

0 comments on commit 7e4c4e1

Please sign in to comment.