From e90304387b0bfc19e962a96378f520879f8d453e Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Wed, 4 Apr 2012 11:59:39 +1000 Subject: Fixed an exit crash that could occur in QQuickPixmap. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Samuel Rødal --- src/gui/image/qimagepixmapcleanuphooks.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') 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); -- cgit v1.2.3