OSDN Git Service

effectively revert c3c697ea5b4e141f08c4607955f085c49667b806
authorIvailo Monev <xakepa10@gmail.com>
Sun, 20 Nov 2022 13:57:36 +0000 (15:57 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Sun, 20 Nov 2022 13:57:36 +0000 (15:57 +0200)
it being static means its destruction will be delayed until exit and it
holds shared data references the meta types of which may be unregistered by
the time it is destroyed

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/styles/qstylesheetstyle.cpp

index e316845..8f5e428 100644 (file)
@@ -1496,12 +1496,15 @@ QVector<QCss::StyleRule> QStyleSheetStyle::styleRules(const QWidget *w) const
 
     QStyleSheetStyleSelector styleSelector;
 
+    StyleSheet defaultSs;
     QStyle *bs = baseStyle();
-    static StyleSheet defaultSs = getDefaultStyleSheet();
     QHash<const void *, StyleSheet>::const_iterator defaultCacheIt = styleSheetCaches->styleSheetCache.constFind(bs);
     if (defaultCacheIt == styleSheetCaches->styleSheetCache.constEnd()) {
+        defaultSs = getDefaultStyleSheet();
         styleSheetCaches->styleSheetCache.insert(bs, defaultSs);
         QObject::connect(bs, SIGNAL(destroyed(QObject*)), styleSheetCaches, SLOT(styleDestroyed(QObject*)), Qt::UniqueConnection);
+    } else {
+        defaultSs = defaultCacheIt.value();
     }
     styleSelector.styleSheets += defaultSs;