diff options
author | Shane Kearns <shane.kearns@sosco.com> | 2009-10-30 16:43:45 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@sosco.com> | 2009-11-03 12:55:16 (GMT) |
commit | 92a393940d2dc3a9e2cd4f27e4ca62643c816f6f (patch) | |
tree | fa126da0824516291314f809577e13642e03081a | |
parent | ddbccf7f066d26d3420c9ed18d8c930200814ce1 (diff) | |
download | Qt-92a393940d2dc3a9e2cd4f27e4ca62643c816f6f.zip Qt-92a393940d2dc3a9e2cd4f27e4ca62643c816f6f.tar.gz Qt-92a393940d2dc3a9e2cd4f27e4ca62643c816f6f.tar.bz2 |
Fix crash in QApplication autotest introduced by native pixmaps (S60 3.1)
Problem was caused by S60 closing a handle under our feet when QApplication
is destroyed. To avoid this, we open our own handle for the global lock
instead of using the shared one inside CFbsBitmap.
Also the global unlock/relock is not needed on S60 3.2 so this can be
eliminated and save a few cycles (the function call was a no-op before)
Reviewed-by: Jani Hautakangas
-rw-r--r-- | src/gui/image/qpixmap_s60.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 7086341..5c7e93f 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -73,27 +73,27 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, used to lock the global bitmap heap. Only used in S60 v3.1 and S60 v3.2. */ +_LIT(KFBSERVLargeBitmapAccessName,"FbsLargeBitmapAccess"); class QSymbianFbsClient { public: - QSymbianFbsClient() : heapLock(0), heapLocked(false) + QSymbianFbsClient() : heapLocked(false) { - QT_TRAP_THROWING(heapLock = new(ELeave) CFbsBitmap); - heapLock->Create(TSize(0,0), S60->screenDevice()->DisplayMode()); + heapLock.OpenGlobal(KFBSERVLargeBitmapAccessName); } ~QSymbianFbsClient() { - delete heapLock; + heapLock.Close(); } bool lockHeap() { bool wasLocked = heapLocked; - if (heapLock && !heapLocked) { - heapLock->LockHeap(ETrue); + if (heapLock.Handle() && !heapLocked) { + heapLock.Wait(); heapLocked = true; } @@ -104,8 +104,8 @@ public: { bool wasLocked = heapLocked; - if (heapLock && heapLocked) { - heapLock->UnlockHeap(ETrue); + if (heapLock.Handle() && heapLocked) { + heapLock.Signal(); heapLocked = false; } @@ -115,7 +115,7 @@ public: private: - CFbsBitmap *heapLock; + RMutex heapLock; bool heapLocked; }; @@ -169,7 +169,7 @@ public: inline void beginDataAccess(CFbsBitmap *bitmap) { - if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) + if (symbianVersion == QSysInfo::SV_9_2) heapWasLocked = qt_symbianFbsClient()->lockHeap(); else bitmap->LockHeap(ETrue); @@ -177,7 +177,7 @@ public: inline void endDataAccess(CFbsBitmap *bitmap) { - if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) { + if (symbianVersion == QSysInfo::SV_9_2) { if (!heapWasLocked) qt_symbianFbsClient()->unlockHeap(); } else { |