From 82de40a963af1ea25b17f43c651aa58519fc31b4 Mon Sep 17 00:00:00 2001 From: Paul Harrison Date: Sun, 8 May 2011 11:39:55 +0100 Subject: [PATCH] MythUIImage: Fix a possible dead lock in SetImage(MythImage *) 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. --- mythtv/libs/libmythui/mythuiimage.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mythtv/libs/libmythui/mythuiimage.cpp b/mythtv/libs/libmythui/mythuiimage.cpp index 851a75f2f37..d272f1f30a1 100644 --- a/mythtv/libs/libmythui/mythuiimage.cpp +++ b/mythtv/libs/libmythui/mythuiimage.cpp @@ -342,9 +342,11 @@ void MythUIImage::SetDelays(QVector delays) */ void MythUIImage::SetImage(MythImage *img) { - QWriteLocker updateLocker(&d->m_UpdateLock); + d->m_UpdateLock.lockForWrite(); + if (!img) { + d->m_UpdateLock.unlock(); Reset(); return; } @@ -379,6 +381,8 @@ void MythUIImage::SetImage(MythImage *img) m_CurPos = 0; SetRedraw(); + + d->m_UpdateLock.unlock(); } /**