src/gui/image/qimagepixmapcleanuphooks.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
equal deleted inserted replaced
18:2f34d5167611 19:fcece45ef507
    94 }
    94 }
    95 
    95 
    96 void QImagePixmapCleanupHooks::executePixmapDataModificationHooks(QPixmapData* pmd)
    96 void QImagePixmapCleanupHooks::executePixmapDataModificationHooks(QPixmapData* pmd)
    97 {
    97 {
    98     QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
    98     QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
       
    99     // the global destructor for the pixmap and image hooks might have
       
   100     // been called already if the app is "leaking" global
       
   101     // pixmaps/images
       
   102     if (!h)
       
   103         return;
    99     for (int i = 0; i < h->pixmapModificationHooks.count(); ++i)
   104     for (int i = 0; i < h->pixmapModificationHooks.count(); ++i)
   100         h->pixmapModificationHooks[i](pmd);
   105         h->pixmapModificationHooks[i](pmd);
   101 
   106 
   102     if (qt_pixmap_cleanup_hook_64)
   107     if (qt_pixmap_cleanup_hook_64)
   103         qt_pixmap_cleanup_hook_64(pmd->cacheKey());
   108         qt_pixmap_cleanup_hook_64(pmd->cacheKey());
   104 }
   109 }
   105 
   110 
   106 void QImagePixmapCleanupHooks::executePixmapDataDestructionHooks(QPixmapData* pmd)
   111 void QImagePixmapCleanupHooks::executePixmapDataDestructionHooks(QPixmapData* pmd)
   107 {
   112 {
   108     QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
   113     QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
       
   114     // the global destructor for the pixmap and image hooks might have
       
   115     // been called already if the app is "leaking" global
       
   116     // pixmaps/images
       
   117     if (!h)
       
   118         return;
   109     for (int i = 0; i < h->pixmapDestructionHooks.count(); ++i)
   119     for (int i = 0; i < h->pixmapDestructionHooks.count(); ++i)
   110         h->pixmapDestructionHooks[i](pmd);
   120         h->pixmapDestructionHooks[i](pmd);
   111 
   121 
   112     if (qt_pixmap_cleanup_hook_64)
   122     if (qt_pixmap_cleanup_hook_64)
   113         qt_pixmap_cleanup_hook_64(pmd->cacheKey());
   123         qt_pixmap_cleanup_hook_64(pmd->cacheKey());