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>
This commit is contained in:
Charles Yin 2012-04-04 11:59:39 +10:00 committed by Qt by Nokia
parent 91e20c0eae
commit e90304387b

View File

@ -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);