src/gui/image/qpixmap_s60.cpp
changeset 33 3e2da88830cd
parent 19 fcece45ef507
child 37 758a864f9613
--- a/src/gui/image/qpixmap_s60.cpp	Tue Jul 06 15:10:48 2010 +0300
+++ b/src/gui/image/qpixmap_s60.cpp	Wed Aug 18 10:37:55 2010 +0300
@@ -157,10 +157,10 @@
 {
 public:
 
-    bool heapWasLocked;
+    static int heapRefCount;
     QSysInfo::SymbianVersion symbianVersion;
 
-    explicit QSymbianBitmapDataAccess() : heapWasLocked(false)
+    explicit QSymbianBitmapDataAccess()
     {
         symbianVersion = QSysInfo::symbianVersion();
     };
@@ -169,16 +169,22 @@
 
     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 @@
     }
 };
 
+int QSymbianBitmapDataAccess::heapRefCount = 0;
+
 
 #define UPDATE_BUFFER()     \
     {                       \