diff options
author | Zhang Yu <zhangyub@uniontech.com> | 2021-06-15 21:05:41 +0800 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-06-18 07:42:58 +0000 |
commit | 398fe0b6a2d9c6fcddbd8b1a586823a3c3990515 (patch) | |
tree | 846679cc0a3f22e57abd85f4c60521fad531076c /src | |
parent | 6900bd8a3672cca6f50252bfe59ddaeeae033243 (diff) |
Fix recursion crash when calling setStyleSheet with `qproperty-styleSheet`
When calling `setStyleSheet` with property `qproperty-styleSheet`,
`QStyleSheetStyle::polish` will call`QStyleSheetStyle::setProperties`, and then`QStyleSheetStyle::setProperties` goes on to call `setProperty`.Because there is property `qproperty-styleSheet`, it will update stylesheet by calling QStyleSheetStyle::polish`.
This causes the recursive call to crash.
Fixes: QTBUG-94448
Change-Id: I79c51192a939b0b62e5b1d0dcc90d38f79e28222
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit e9cdcc7cb314586aec76b8b9979435f0af963443)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index b02e4011b2..226c1ecbf9 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2670,6 +2670,9 @@ void QStyleSheetStyle::setProperties(QWidget *w) default: v = decl.d->values.at(0).variant; break; } + if (propertyL1 == QByteArrayView("styleSheet") && value == v) + continue; + w->setProperty(propertyL1, v); } } |