Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PlatformTheme: fix crash when item is being destroyed
When a quick item is being destroyed, it will emit windowChanged signal which PlatformTheme connects to. This can causes a crash when the style option of the quick item is already deleted but the colorsChanged signal still tries to assign a new palette to the style option. ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==16652==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000030 (pc 0x7fa13639083b bp 0x7ffcad9111f0 sp 0x7ffcad911180 T0) ==16652==The signal is caused by a READ memory access. ==16652==Hint: address points to the zero page. #0 0x7fa13639083b in std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<QPalette::ColorGroup> >, std::is_move_constructible<QPalette::ColorGroup>, std::is_move_assignable<QPalette::ColorGroup> >::value, void>::type std::swap<QPalette::ColorGroup>(QPalette::ColorGroup&, QPalette::ColorGroup&) /usr/include/c++/14/bits/move.h:221 #1 0x7fa13638b12c in QPalette::swap(QPalette&) /usr/include/qt6/QtGui/qpalette.h:41 #2 0x7fa13638b0d6 in QPalette::operator=(QPalette&&) /usr/include/qt6/QtGui/qpalette.h:37 #3 0x7fa1363426ee in operator() /builds/frameworks/qqc2-desktop-style/plugin/kquickstyleitem.cpp:175 #4 0x7fa13637d120 in call /usr/include/qt6/QtCore/qobjectdefs_impl.h:137 #5 0x7fa13637cfee in call<QtPrivate::List<>, void> /usr/include/qt6/QtCore/qobjectdefs_impl.h:345 #6 0x7fa13637ce29 in impl /usr/include/qt6/QtCore/qobjectdefs_impl.h:555 #7 0x7fa18b657ade (/lib64/libQt6Core.so.6+0x1ecade) (BuildId: aee9214d20a4f3972e90ce77c58a3a383a28d4bb) #8 0x7fa1445e2ac9 in Kirigami::Platform::PlatformTheme::colorsChanged() /builds/frameworks/kirigami/_build/src/platform/KirigamiPlatform_autogen/include/moc_platformtheme.cpp:531 #9 0x7fa1445db7d6 in Kirigami::Platform::PlatformTheme::emitSignalsForChanges(int) /builds/frameworks/kirigami/src/platform/platformtheme.cpp:883 #10 0x7fa1445ddc83 in Kirigami::Platform::PlatformThemeChangeTracker::~PlatformThemeChangeTracker() /builds/frameworks/kirigami/src/platform/platformtheme.cpp:1052 #11 0x7fa1445e94e2 in Kirigami::Platform::PlatformThemePrivate::setDataColor(Kirigami::Platform::PlatformTheme*, Kirigami::Platform::PlatformThemeData::ColorRole, QColor const&) /builds/frameworks/kirigami/src/platform/platformtheme.cpp:347 #12 0x7fa1445d9135 in Kirigami::Platform::PlatformTheme::setTextColor(QColor const&) /builds/frameworks/kirigami/src/platform/platformtheme.cpp:556 #13 0x7fa14a6fc555 in PlasmaDesktopTheme::syncColors() /builds/frameworks/qqc2-desktop-style/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp:294 #14 0x7fa14a6fd812 in PlasmaDesktopTheme::event(QEvent*) /builds/frameworks/qqc2-desktop-style/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp:323 #15 0x7fa19281989d in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/lib64/libQt6Widgets.so.6+0x1c489d) (BuildId: 9f6bf5a66eec5ecad15a389c3f9c5c7217e59b98) #16 0x7fa18b5fde97 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/lib64/libQt6Core.so.6+0x192e97) (BuildId: aee9214d20a4f3972e90ce77c58a3a383a28d4bb) #17 0x7fa1445dd177 in Kirigami::Platform::PlatformTheme::update() /builds/frameworks/kirigami/src/platform/platformtheme.cpp:994 #18 0x7fa144606d09 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (Kirigami::Platform::PlatformTheme::*)()>::call(void (Kirigami::Platform::PlatformTheme::*)(), Kirigami::Platform::PlatformTheme*, void**) /usr/include/qt6/QtCore/qobjectdefs_impl.h:145 #19 0x7fa1446032f9 in void QtPrivate::FunctionPointer<void (Kirigami::Platform::PlatformTheme::*)()>::call<QtPrivate::List<>, void>(void (Kirigami::Platform::PlatformTheme::*)(), Kirigami::Platform::PlatformTheme*, void**) /usr/include/qt6/QtCore/qobjectdefs_impl.h:182 #20 0x7fa1445fe98c in QtPrivate::QCallableObject<void (Kirigami::Platform::PlatformTheme::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) /usr/include/qt6/QtCore/qobjectdefs_impl.h:553 #21 0x7fa18b657ade (/lib64/libQt6Core.so.6+0x1ecade) (BuildId: aee9214d20a4f3972e90ce77c58a3a383a28d4bb) #22 0x7fa18cb09e91 in QQuickItem::windowChanged(QQuickWindow*) (/lib64/libQt6Quick.so.6+0x231e91) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #23 0x7fa18cafdab4 in QQuickItemPrivate::itemChange(QQuickItem::ItemChange, QQuickItem::ItemChangeData const&) (/lib64/libQt6Quick.so.6+0x225ab4) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #24 0x7fa18cafdee6 in QQuickItemPrivate::derefWindow() (/lib64/libQt6Quick.so.6+0x225ee6) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #25 0x7fa18caf45d6 in QQuickItem::setParentItem(QQuickItem*) (/lib64/libQt6Quick.so.6+0x21c5d6) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #26 0x7fa18caf486c in QQuickItem::~QQuickItem() (/lib64/libQt6Quick.so.6+0x21c86c) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #27 0x7fa136342506 in KQuickStyleItem::~KQuickStyleItem() /builds/frameworks/qqc2-desktop-style/plugin/kquickstyleitem.cpp:165 #28 0x7fa13633f500 in QQmlPrivate::QQmlElement<KQuickStyleItem>::~QQmlElement() /usr/include/qt6/QtQml/qqmlprivate.h:100 #29 0x7fa13633f565 in QQmlPrivate::QQmlElement<KQuickStyleItem>::~QQmlElement() /usr/include/qt6/QtQml/qqmlprivate.h:100 #30 0x7fa19db75e86 in QQmlTableInstanceModel::destroyModelItem(QQmlDelegateModelItem*, QQmlTableInstanceModel::DestructionMode) (/lib64/libQt6QmlModels.so.6+0x43e86) (BuildId: 58984efcd9008b78aa05e7bc535f7bd970db97a3) #31 0x7fa19dbb5225 (/lib64/libQt6QmlModels.so.6+0x83225) (BuildId: 58984efcd9008b78aa05e7bc535f7bd970db97a3) #32 0x7fa19db73e9d in QQmlTableInstanceModel::drainReusableItemsPool(int) (/lib64/libQt6QmlModels.so.6+0x41e9d) (BuildId: 58984efcd9008b78aa05e7bc535f7bd970db97a3) #33 0x7fa18cdc10a3 in QQuickTableView::geometryChange(QRectF const&, QRectF const&) (/lib64/libQt6Quick.so.6+0x4e90a3) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #34 0x7fa18cb03cc6 in QQuickItem::setImplicitWidth(double) (/lib64/libQt6Quick.so.6+0x22bcc6) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #35 0x7fa18c5eb793 (/lib64/libQt6Qml.so.6+0x28d793) (BuildId: f6e62c1c256507fb05665d132a575c79a03df31b) #36 0x7fa18c5fff2b (/lib64/libQt6Qml.so.6+0x2a1f2b) (BuildId: f6e62c1c256507fb05665d132a575c79a03df31b) #37 0x7fa18c6034ec in QQmlBinding::doUpdate(QQmlJavaScriptExpression::DeleteWatcher const&, QFlags<QQmlPropertyData::WriteFlag>, QV4::Scope&) (/lib64/libQt6Qml.so.6+0x2a54ec) (BuildId: f6e62c1c256507fb05665d132a575c79a03df31b) #38 0x7fa18c5fb3f3 in QQmlBinding::update(QFlags<QQmlPropertyData::WriteFlag>) (/lib64/libQt6Qml.so.6+0x29d3f3) (BuildId: f6e62c1c256507fb05665d132a575c79a03df31b) #39 0x7fa18ce660fa (/lib64/libQt6Quick.so.6+0x58e0fa) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #40 0x7fa18cb0e0a3 (/lib64/libQt6Quick.so.6+0x2360a3) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #41 0x7fa18caf6e46 in QQuickItem::geometryChange(QRectF const&, QRectF const&) (/lib64/libQt6Quick.so.6+0x21ee46) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #42 0x7fa18cae0399 in QQuickFlickable::geometryChange(QRectF const&, QRectF const&) (/lib64/libQt6Quick.so.6+0x208399) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #43 0x7fa18cb0481a in QQuickItem::setSize(QSizeF const&) (/lib64/libQt6Quick.so.6+0x22c81a) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #44 0x7fa17e28b0d8 in QQuickControlPrivate::resizeContent() (/lib64/libQt6QuickTemplates2.so.6+0x1050d8) (BuildId: 7c6282faf8f2b320e8953d270d4b645d6a5f2483) #45 0x7fa17e2835d5 in QQuickControl::geometryChange(QRectF const&, QRectF const&) (/lib64/libQt6QuickTemplates2.so.6+0xfd5d5) (BuildId: 7c6282faf8f2b320e8953d270d4b645d6a5f2483) #46 0x7fa18cb0481a in QQuickItem::setSize(QSizeF const&) (/lib64/libQt6Quick.so.6+0x22c81a) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #47 0x7fa14175a03c (/lib64/libQt6QuickLayouts.so.6+0x2403c) (BuildId: 42940452496a72263fb8667e3486c8d85ac71889) #48 0x7fa18bf7c0ea in QGridLayoutEngine::setGeometries(QRectF const&, QAbstractLayoutStyleInfo const*) (/lib64/libQt6Gui.so.6+0x4d20ea) (BuildId: ff7f0a31774cc86be95eb627cc16c43cce71c6a1) #49 0x7fa14175a54c in QQuickGridLayoutBase::rearrange(QSizeF const&) (/lib64/libQt6QuickLayouts.so.6+0x2454c) (BuildId: 42940452496a72263fb8667e3486c8d85ac71889) #50 0x7fa141755379 in QQuickLayout::geometryChange(QRectF const&, QRectF const&) (/lib64/libQt6QuickLayouts.so.6+0x1f379) (BuildId: 42940452496a72263fb8667e3486c8d85ac71889) #51 0x7fa18cb0481a in QQuickItem::setSize(QSizeF const&) (/lib64/libQt6Quick.so.6+0x22c81a) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #52 0x7fa14175a03c (/lib64/libQt6QuickLayouts.so.6+0x2403c) (BuildId: 42940452496a72263fb8667e3486c8d85ac71889) #53 0x7fa18bf7c0ea in QGridLayoutEngine::setGeometries(QRectF const&, QAbstractLayoutStyleInfo const*) (/lib64/libQt6Gui.so.6+0x4d20ea) (BuildId: ff7f0a31774cc86be95eb627cc16c43cce71c6a1) #54 0x7fa14175a54c in QQuickGridLayoutBase::rearrange(QSizeF const&) (/lib64/libQt6QuickLayouts.so.6+0x2454c) (BuildId: 42940452496a72263fb8667e3486c8d85ac71889) #55 0x7fa14175694b in QQuickLayout::updatePolish() (/lib64/libQt6QuickLayouts.so.6+0x2094b) (BuildId: 42940452496a72263fb8667e3486c8d85ac71889) #56 0x7fa18cb9e101 in QQuickWindowPrivate::polishItems() (/lib64/libQt6Quick.so.6+0x2c6101) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #57 0x7fa18cd53eee (/lib64/libQt6Quick.so.6+0x47beee) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #58 0x7fa18cba4300 in QQuickWindow::event(QEvent*) (/lib64/libQt6Quick.so.6+0x2cc300) (BuildId: 0f79e6418d06df30d4d02a5215617a84a5dcf733) #59 0x7fa19281989d in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/lib64/libQt6Widgets.so.6+0x1c489d) (BuildId: 9f6bf5a66eec5ecad15a389c3f9c5c7217e59b98) #60 0x7fa18b5fde97 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/lib64/libQt6Core.so.6+0x192e97) (BuildId: aee9214d20a4f3972e90ce77c58a3a383a28d4bb)
- Loading branch information