summaryrefslogtreecommitdiffstats
path: root/tools/designer/src/components/propertyeditor
diff options
context:
space:
mode:
authorJarek Kobus <jkobus@trolltech.com>2010-04-14 10:06:24 (GMT)
committerJarek Kobus <jkobus@trolltech.com>2010-04-14 10:06:24 (GMT)
commit274404a2a349b80dbfc5dcd5a2daa0b0bf5d30d6 (patch)
treef05b636b36be2b8f58236db19fe25d6a2cda5216 /tools/designer/src/components/propertyeditor
parent4ca8db7b01793a97489b75d093e289a8ec9c23a0 (diff)
downloadQt-274404a2a349b80dbfc5dcd5a2daa0b0bf5d30d6.zip
Qt-274404a2a349b80dbfc5dcd5a2daa0b0bf5d30d6.tar.gz
Qt-274404a2a349b80dbfc5dcd5a2daa0b0bf5d30d6.tar.bz2
Remove statically allocated pixmaps through the post routine
In order to avoid native pixmap object leaking remove statically allocated pixmaps through the post routine. Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Task-number: QTBUG-9815
Diffstat (limited to 'tools/designer/src/components/propertyeditor')
-rw-r--r--tools/designer/src/components/propertyeditor/brushpropertymanager.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/designer/src/components/propertyeditor/brushpropertymanager.cpp b/tools/designer/src/components/propertyeditor/brushpropertymanager.cpp
index 6e9a698..2300b47 100644
--- a/tools/designer/src/components/propertyeditor/brushpropertymanager.cpp
+++ b/tools/designer/src/components/propertyeditor/brushpropertymanager.cpp
@@ -119,21 +119,31 @@ Qt::BrushStyle BrushPropertyManager::brushStyleIndexToStyle(int brushStyleIndex)
return Qt::NoBrush;
}
+
+typedef QMap<int, QIcon> EnumIndexIconMap;
+
+static void clearBrushIcons();
+Q_GLOBAL_STATIC_WITH_INITIALIZER(EnumIndexIconMap, brushIcons, qAddPostRoutine(clearBrushIcons))
+
+static void clearBrushIcons()
+{
+ brushIcons()->clear();
+}
+
const BrushPropertyManager::EnumIndexIconMap &BrushPropertyManager::brushStyleIcons()
{
// Create a map of icons for the brush style editor
- static EnumIndexIconMap rc;
- if (rc.empty()) {
+ if (brushIcons()->empty()) {
const int brushStyleCount = sizeof(brushStyles)/sizeof(const char *);
QBrush brush(Qt::black);
const QIcon solidIcon = QtPropertyBrowserUtils::brushValueIcon(brush);
for (int i = 0; i < brushStyleCount; i++) {
const Qt::BrushStyle style = brushStyleIndexToStyle(i);
brush.setStyle(style);
- rc.insert(i, QtPropertyBrowserUtils::brushValueIcon(brush));
+ brushIcons()->insert(i, QtPropertyBrowserUtils::brushValueIcon(brush));
}
}
- return rc;
+ return *(brushIcons());
}
QString BrushPropertyManager::brushStyleIndexToString(int brushStyleIndex)