Skip to content

Commit

Permalink
MythUIImage: Fix a possible dead lock in SetImage(MythImage *)
Browse files Browse the repository at this point in the history
It was possible to completely lockup the FE if a NULL image was passed to this
function because other parts of MythUIImage would try to obtain a read lock
while this function still had the write lock causing the FE to lock up.
  • Loading branch information
Paul Harrison committed May 8, 2011
1 parent 944423f commit 82de40a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mythtv/libs/libmythui/mythuiimage.cpp
Expand Up @@ -342,9 +342,11 @@ void MythUIImage::SetDelays(QVector<int> delays)
*/
void MythUIImage::SetImage(MythImage *img)
{
QWriteLocker updateLocker(&d->m_UpdateLock);
d->m_UpdateLock.lockForWrite();

if (!img)
{
d->m_UpdateLock.unlock();
Reset();
return;
}
Expand Down Expand Up @@ -379,6 +381,8 @@ void MythUIImage::SetImage(MythImage *img)

m_CurPos = 0;
SetRedraw();

d->m_UpdateLock.unlock();
}

/**
Expand Down

0 comments on commit 82de40a

Please sign in to comment.