summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2012-04-04 11:59:39 +1000
committerQt by Nokia <qt-info@nokia.com>2012-04-05 08:14:36 +0200
commite90304387b0bfc19e962a96378f520879f8d453e (patch)
tree0690cf2bd9d8baad881aabebf6ceed37edf1919f /src/gui
parent91e20c0eae53fb4638773ffd4ce74b3c76271c71 (diff)
Fixed an exit crash that could occur in QQuickPixmap.
The global destructor for the clean up hooks might be called before the global destructor for QQuickPixmapCache objects. This is an additional fix for QTBUG-8681 Task-number: QTBUG-8681 Change-Id: I8694a7a246980f488aef78071c613e3a908c7db3 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp
index 6d8693ffb1..5b414b8d00 100644
--- a/src/gui/image/qimagepixmapcleanuphooks.cpp
+++ b/src/gui/image/qimagepixmapcleanuphooks.cpp
@@ -125,8 +125,14 @@ void QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(QPlatformPi
void QImagePixmapCleanupHooks::executeImageHooks(qint64 key)
{
- for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks()->imageHooks.count(); ++i)
- qt_image_and_pixmap_cleanup_hooks()->imageHooks[i](key);
+ 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->imageHooks.count(); ++i)
+ h->imageHooks[i](key);
if (qt_image_cleanup_hook_64)
qt_image_cleanup_hook_64(key);