Changeset 62652 in webkit


Ignore:
Timestamp:
Jul 7, 2010 4:39:21 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-07-07 Marc Mutz <marc.mutz@kdab.com>

Reviewed by Adam Barth.

[Qt] QWebSettings: Don't leak native pixmaps

When Q_GLOBAL_STATIC gets around to deleting the QHash with the
pixmaps in, the QApplication destructor has already been
completed. This makes it impossible for ~QPixmap to return the
native pixmap to the OS, thus leaking them.

This patch adds a post routine (executed as part of ~QApplication)
that clears the hash so Q_GLOBAL_STATIC's destruction doesn't have
to execute ~QPixmap's anymore.

https://bugs.webkit.org/show_bug.cgi?id=41657

  • Api/qwebsettings.cpp: (earlyClearGraphics): New. Clears the pixmap hash. (graphics): add earlyClearGraphics as a qAddPostRoutine()
Location:
trunk/WebKit/qt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/Api/qwebsettings.cpp

    r62249 r62652  
    8181Q_GLOBAL_STATIC(WebGraphicHash, _graphics)
    8282
     83static void earlyClearGraphics()
     84{
     85    _graphics()->clear();
     86}
     87
    8388static WebGraphicHash* graphics()
    8489{
     
    8691
    8792    if (hash->isEmpty()) {
     93
     94        // prevent ~QPixmap running after ~QApplication (leaks native pixmaps)
     95        qAddPostRoutine(earlyClearGraphics);
     96
    8897        hash->insert(QWebSettings::MissingImageGraphic, QPixmap(QLatin1String(":webkit/resources/missingImage.png")));
    8998        hash->insert(QWebSettings::MissingPluginGraphic, QPixmap(QLatin1String(":webkit/resources/nullPlugin.png")));
  • trunk/WebKit/qt/ChangeLog

    r62602 r62652  
     12010-07-07  Marc Mutz  <marc.mutz@kdab.com>
     2
     3        Reviewed by Adam Barth.
     4
     5        [Qt] QWebSettings: Don't leak native pixmaps
     6
     7        When Q_GLOBAL_STATIC gets around to deleting the QHash with the
     8        pixmaps in, the QApplication destructor has already been
     9        completed. This makes it impossible for ~QPixmap to return the
     10        native pixmap to the OS, thus leaking them.
     11
     12        This patch adds a post routine (executed as part of ~QApplication)
     13        that clears the hash so Q_GLOBAL_STATIC's destruction doesn't have
     14        to execute ~QPixmap's anymore.
     15
     16        https://bugs.webkit.org/show_bug.cgi?id=41657
     17
     18        * Api/qwebsettings.cpp:
     19        (earlyClearGraphics): New. Clears the pixmap hash.
     20        (graphics): add earlyClearGraphics as a qAddPostRoutine()
     21
    1222010-07-06  Csaba Osztrogonác  <ossy@webkit.org>
    223
Note: See TracChangeset for help on using the changeset viewer.