From 6777c3f0da620a380e348116dce2bb4ed6bfe93b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Jen=C3=9Fen?= Date: Wed, 26 Mar 2025 10:52:13 +0100 Subject: [PATCH] QmlDesigner: fix shutdown crash - m_dialog is already deleted by the parent, found in sentry https://the-qt-company-00.sentry.io/issues/6138135652/ - also fix a clazy warning in the connects Pick-to: qds/4.7 Change-Id: Icd8731f2d7863d18af2e9e834223c95f6d99a1f6 Reviewed-by: Tim Jenssen --- .../components/richtexteditor/richtexteditorproxy.cpp | 4 ++-- .../components/richtexteditor/richtexteditorproxy.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmldesigner/components/richtexteditor/richtexteditorproxy.cpp b/src/plugins/qmldesigner/components/richtexteditor/richtexteditorproxy.cpp index 185a4060059..1d269c71e1a 100644 --- a/src/plugins/qmldesigner/components/richtexteditor/richtexteditorproxy.cpp +++ b/src/plugins/qmldesigner/components/richtexteditor/richtexteditorproxy.cpp @@ -34,8 +34,8 @@ RichTextEditorProxy::RichTextEditorProxy(QObject *parent) m_dialog->setLayout(layout); - connect(m_dialog, &QDialog::accepted, [this] { emit accepted(); }); - connect(m_dialog, &QDialog::rejected, [this] { emit rejected(); }); + connect(m_dialog, &QDialog::accepted, this, &RichTextEditorProxy::accepted); + connect(m_dialog, &QDialog::rejected, this, &RichTextEditorProxy::rejected); } RichTextEditorProxy::~RichTextEditorProxy() diff --git a/src/plugins/qmldesigner/components/richtexteditor/richtexteditorproxy.h b/src/plugins/qmldesigner/components/richtexteditor/richtexteditorproxy.h index 02985364591..0e58ea3f1e6 100644 --- a/src/plugins/qmldesigner/components/richtexteditor/richtexteditorproxy.h +++ b/src/plugins/qmldesigner/components/richtexteditor/richtexteditorproxy.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include QT_BEGIN_NAMESPACE @@ -36,7 +37,7 @@ signals: void rejected(); private: - QDialog *m_dialog; + QPointer m_dialog; RichTextEditor *m_widget; };