From 180e84ad39cf135d5facbd43e9ea3be830b2fe1f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 20 Oct 2011 11:19:17 +0200 Subject: [PATCH] Remove use of Q_GLOBAL_STATIC_WITH_INITIALIZER This macro was evil. It's gone now. Change-Id: Ib33b23e4055de7361b8527009e4bc007d077a39d Reviewed-by: Friedemann Kleint --- .../components/propertyeditor/brushpropertymanager.cpp | 15 ++++++++++++--- src/shared/qtpropertybrowser/qtpropertymanager.cpp | 11 ++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/designer/src/components/propertyeditor/brushpropertymanager.cpp b/src/designer/src/components/propertyeditor/brushpropertymanager.cpp index 176e663..94cc739 100644 --- a/src/designer/src/components/propertyeditor/brushpropertymanager.cpp +++ b/src/designer/src/components/propertyeditor/brushpropertymanager.cpp @@ -119,11 +119,20 @@ Qt::BrushStyle BrushPropertyManager::brushStyleIndexToStyle(int brushStyleIndex) return Qt::NoBrush; } +static void clearBrushIcons(); -typedef QMap EnumIndexIconMap; +namespace { +class EnumIndexIconMap : public QMap +{ +public: + EnumIndexIconMap() + { + qAddPostRoutine(clearBrushIcons); + } +}; +} -static void clearBrushIcons(); -Q_GLOBAL_STATIC_WITH_INITIALIZER(EnumIndexIconMap, brushIcons, qAddPostRoutine(clearBrushIcons)) +Q_GLOBAL_STATIC(EnumIndexIconMap, brushIcons) static void clearBrushIcons() { diff --git a/src/shared/qtpropertybrowser/qtpropertymanager.cpp b/src/shared/qtpropertybrowser/qtpropertymanager.cpp index 29abb66..222c5ab 100644 --- a/src/shared/qtpropertybrowser/qtpropertymanager.cpp +++ b/src/shared/qtpropertybrowser/qtpropertymanager.cpp @@ -6304,7 +6304,16 @@ void QtColorPropertyManager::uninitializeProperty(QtProperty *property) // Make sure icons are removed as soon as QApplication is destroyed, otherwise, // handles are leaked on X11. static void clearCursorDatabase(); -Q_GLOBAL_STATIC_WITH_INITIALIZER(QtCursorDatabase, cursorDatabase, qAddPostRoutine(clearCursorDatabase)) +namespace { +struct CursorDatabase : public QtCursorDatabase +{ + CursorDatabase() + { + qAddPostRoutine(clearCursorDatabase); + } +}; +} +Q_GLOBAL_STATIC(QtCursorDatabase, cursorDatabase) static void clearCursorDatabase() { -- 2.7.4