src/gui/image/qimagepixmapcleanuphooks.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
--- a/src/gui/image/qimagepixmapcleanuphooks.cpp	Fri Apr 16 15:50:13 2010 +0300
+++ b/src/gui/image/qimagepixmapcleanuphooks.cpp	Mon May 03 13:17:34 2010 +0300
@@ -96,6 +96,11 @@
 void QImagePixmapCleanupHooks::executePixmapDataModificationHooks(QPixmapData* pmd)
 {
     QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
+    // the global destructor for the pixmap and image hooks might have
+    // been called already if the app is "leaking" global
+    // pixmaps/images
+    if (!h)
+        return;
     for (int i = 0; i < h->pixmapModificationHooks.count(); ++i)
         h->pixmapModificationHooks[i](pmd);
 
@@ -106,6 +111,11 @@
 void QImagePixmapCleanupHooks::executePixmapDataDestructionHooks(QPixmapData* pmd)
 {
     QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
+    // the global destructor for the pixmap and image hooks might have
+    // been called already if the app is "leaking" global
+    // pixmaps/images
+    if (!h)
+        return;
     for (int i = 0; i < h->pixmapDestructionHooks.count(); ++i)
         h->pixmapDestructionHooks[i](pmd);