summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qicon.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-09 19:47:41 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-09 19:47:41 (GMT)
commitefbef9186785dcc522b41978b391411aa272b0c7 (patch)
treee88e788909d7bea50d1d85743499bd4a2a86189d /src/gui/image/qicon.cpp
parentecf66e5825d186f57468c6bf682dce32c0cd96d7 (diff)
parenta49a2ae399643afd30dd5d2df90ecb6d6325121a (diff)
downloadQt-efbef9186785dcc522b41978b391411aa272b0c7.zip
Qt-efbef9186785dcc522b41978b391411aa272b0c7.tar.gz
Qt-efbef9186785dcc522b41978b391411aa272b0c7.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fixed some global QIcon/QPixmap instances that leaked handles on X11. Speed up QListView test QListView: fix crash when hiding many of the lasts item in a QListView Fixed warnings and crash when painting graphics effects outside scene. Stabilize QLineEdit test on X11 (sqlite) Allow shared cache mode Make generate uid3 (symbian) work on 64 bit host platform. Updated the docs for QPainter::begin/endNativePainting() Compile fix for network benchmarks. Add a pixmap modification hook to blur pixmap filter cache Delete benchmark examples (qtestlib-simple and qtwidgets). Restructure tests/benchmarks directory. Fixed QImagReader::setAutoDetectImageFormat() to work with plugins. QLineEdit: regression: read-only line edits would eat shortcuts. QGraphicsItem: Do not crash at exit if there is static QGraphicsItem. Make QTextCodec reentrant. Fixed bug where GL widget was not fully updated on Vista.
Diffstat (limited to 'src/gui/image/qicon.cpp')
-rw-r--r--src/gui/image/qicon.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index ac1d303..bf6eb8d 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -104,6 +104,15 @@ QT_BEGIN_NAMESPACE
static QBasicAtomicInt serialNumCounter = Q_BASIC_ATOMIC_INITIALIZER(1);
+static void qt_cleanup_icon_cache();
+typedef QCache<QString, QIcon> IconCache;
+Q_GLOBAL_STATIC_WITH_INITIALIZER(IconCache, qtIconCache, qAddPostRoutine(qt_cleanup_icon_cache))
+
+static void qt_cleanup_icon_cache()
+{
+ qtIconCache()->clear();
+}
+
QIconPrivate::QIconPrivate()
: engine(0), ref(1),
serialNum(serialNumCounter.fetchAndAddRelaxed(1)),
@@ -963,15 +972,13 @@ QString QIcon::themeName()
*/
QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback)
{
- static QCache <QString, QIcon> iconCache;
-
QIcon icon;
- if (iconCache.contains(name)) {
- icon = *iconCache.object(name);
+ if (qtIconCache()->contains(name)) {
+ icon = *qtIconCache()->object(name);
} else {
QIcon *cachedIcon = new QIcon(new QIconLoaderEngine(name));
- iconCache.insert(name, cachedIcon);
+ qtIconCache()->insert(name, cachedIcon);
icon = *cachedIcon;
}