From 77339982b2bf9cb6834b88dcd50f511d43ec91a9 Mon Sep 17 00:00:00 2001 From: ck Date: Thu, 22 Aug 2024 11:12:05 +0800 Subject: [PATCH] fix: crashed on palette destroyed do not set value if app is about to quit Issue: linuxdeepin/dtk#193 --- src/private/dquickcontrolpalette.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/private/dquickcontrolpalette.cpp b/src/private/dquickcontrolpalette.cpp index 2fe3e00d..2777eaec 100644 --- a/src/private/dquickcontrolpalette.cpp +++ b/src/private/dquickcontrolpalette.cpp @@ -18,6 +18,7 @@ #include #include #include +#include DGUI_USE_NAMESPACE DQUICK_BEGIN_NAMESPACE @@ -938,7 +939,9 @@ void DQuickControlColorSelector::notifyColorPropertyChanged() void DQuickControlColorSelector::updatePropertyFromName(const QByteArray &name, const DQuickControlPalette *palette) { - if (QCoreApplication::closingDown()) + auto appriv = dynamic_cast(QObjectPrivate::get(qApp)); + Q_ASSERT(appriv); + if (QCoreApplication::closingDown() || !appriv || appriv->aboutToQuitEmitted) return; Q_ASSERT(!name.isEmpty()); QColor color;