diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-05 11:59:18 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-05 16:47:21 (GMT) |
commit | 7b63ce043dfaec5ec83d938b1cea8ee0ead614ff (patch) | |
tree | ed70eb1a750fc69c54a0595c235b5183d59b9ee9 /src/gui/styles/qstylesheetstyle_p.h | |
parent | 1bfdedb16fdcafc0fdbcea342d68801b8404ea24 (diff) | |
download | Qt-7b63ce043dfaec5ec83d938b1cea8ee0ead614ff.zip Qt-7b63ce043dfaec5ec83d938b1cea8ee0ead614ff.tar.gz Qt-7b63ce043dfaec5ec83d938b1cea8ee0ead614ff.tar.bz2 |
QStyleSheetStyle: Fix crash that occurs with several instance of QStyleSheetStyle
The problem is that when a widget is destroyed, it was not properly removed
from the cache. We connected the destroyed signal to a slot in the
QStyleSheetStyle for the first QStyleSheetStyle that handle a widget.
but if this QStyleSheetStyle is destroyed, that connection is lost.
Solution: Create a new QStyleSheetStyleCaches that will be responsible
to clean the caches. This objects is not destroyed as long as there is
a QStyleSheetStyle instance, so the connection is not lost.
I took the oportunity to move all the caches to this object.
Reveiwed-by: Gabriel
Task-number: QTBUG-11658
Diffstat (limited to 'src/gui/styles/qstylesheetstyle_p.h')
-rw-r--r-- | src/gui/styles/qstylesheetstyle_p.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/gui/styles/qstylesheetstyle_p.h b/src/gui/styles/qstylesheetstyle_p.h index fd81437..4564950 100644 --- a/src/gui/styles/qstylesheetstyle_p.h +++ b/src/gui/styles/qstylesheetstyle_p.h @@ -145,10 +145,6 @@ protected Q_SLOTS: protected: bool event(QEvent *e); -private Q_SLOTS: - void widgetDestroyed(QObject *); - void styleDestroyed(QObject *); - private: int refcount; @@ -186,6 +182,22 @@ private: Q_DECLARE_PRIVATE(QStyleSheetStyle) }; +class QStyleSheetStyleCaches : public QObject +{ + Q_OBJECT +public Q_SLOTS: + void widgetDestroyed(QObject *); + void styleDestroyed(QObject *); +public: + QHash<const QWidget *, QVector<QCss::StyleRule> > styleRulesCache; + QHash<const QWidget *, QHash<int, bool> > hasStyleRuleCache; + typedef QHash<int, QHash<quint64, QRenderRule> > QRenderRules; + QHash<const QWidget *, QRenderRules> renderRulesCache; + QHash<const QWidget *, QPalette> customPaletteWidgets; // widgets whose palette we tampered + QHash<const void *, QCss::StyleSheet> styleSheetCache; // parsed style sheets + QSet<const QWidget *> autoFillDisabledWidgets; +}; + QT_END_NAMESPACE #endif // QT_NO_STYLE_STYLESHEET |