From d4cc1dcea5b4116767cfee0ec45bfba72dc011ff Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 19 Jul 2010 16:44:26 +0200 Subject: Fixed a QSplashScreen hanging bug in S60 3.1 devices. QSymbianBitmapDataAccess is used to provide access to the bitmap heap in a manner that locks correctly on all platform versions. The heapWasLocked variable was meant to protect against the case where the heap is locked recursively. However, it failed to take into account the case where the same QSymbianBitmapDataAccess object was used to lock recursively. In this case the variable would be changed to true on the second lock, which means that the lock would never be released again. This was fixed by making the access reference counted instead. Since the bitmap heap lock is global, the refcount was made global as well. Task: QTBUG-11129 RevBy: Jason Barron AutoTest: Works again. It was hanging before this fix. --- src/gui/image/qpixmap_s60.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index a13c8c8..9d571b5 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -157,10 +157,10 @@ class QSymbianBitmapDataAccess { public: - bool heapWasLocked; + static int heapRefCount; QSysInfo::SymbianVersion symbianVersion; - explicit QSymbianBitmapDataAccess() : heapWasLocked(false) + explicit QSymbianBitmapDataAccess() { symbianVersion = QSysInfo::symbianVersion(); }; @@ -169,16 +169,22 @@ public: inline void beginDataAccess(CFbsBitmap *bitmap) { - if (symbianVersion == QSysInfo::SV_9_2) - heapWasLocked = qt_symbianFbsClient()->lockHeap(); - else + if (symbianVersion == QSysInfo::SV_9_2) { + if (heapRefCount == 0) + qt_symbianFbsClient()->lockHeap(); + } else { bitmap->LockHeap(ETrue); + } + + heapRefCount++; } inline void endDataAccess(CFbsBitmap *bitmap) { + heapRefCount--; + if (symbianVersion == QSysInfo::SV_9_2) { - if (!heapWasLocked) + if (heapRefCount == 0) qt_symbianFbsClient()->unlockHeap(); } else { bitmap->UnlockHeap(ETrue); @@ -186,6 +192,8 @@ public: } }; +int QSymbianBitmapDataAccess::heapRefCount = 0; + #define UPDATE_BUFFER() \ { \ -- cgit v0.12