diff -r 79de32ba3296 -r 89e065397ea6 src/gui/styles/qstylesheetstyle.cpp --- a/src/gui/styles/qstylesheetstyle.cpp Fri May 14 16:40:13 2010 +0300 +++ b/src/gui/styles/qstylesheetstyle.cpp Thu May 27 13:40:48 2010 +0300 @@ -1533,7 +1533,9 @@ QHash::const_iterator defaultCacheIt = styleSheetCache->constFind(baseStyle()); if (defaultCacheIt == styleSheetCache->constEnd()) { defaultSs = getDefaultStyleSheet(); - styleSheetCache->insert(baseStyle(), defaultSs); + QStyle *bs = baseStyle(); + styleSheetCache->insert(bs, defaultSs); + QObject::connect(bs, SIGNAL(destroyed(QObject*)), this, SLOT(styleDestroyed(QObject*)), Qt::UniqueConnection); } else { defaultSs = defaultCacheIt.value(); } @@ -2660,6 +2662,11 @@ autoFillDisabledWidgets->remove((const QWidget *)o); } +void QStyleSheetStyle::styleDestroyed(QObject *o) +{ + styleSheetCache->remove(o); +} + /*! * Make sure that the cache will be clean by connecting destroyed if needed. * return false if the widget is not stylable;