From bd6e47ce4609c152849d61e56c0735cf0df0edbc Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Wed, 12 Jun 2024 16:17:23 +0200 Subject: [PATCH] Core: Fix use after free ASAN error When closing the "Preferences..." dialog with Esc key, the ASAN address checker would report a use after free at "while (m_running)" below in the code. Fixes: QTCREATORBUG-31047 Change-Id: I484a80305ebbd903607e945eb56b331f57d40370 Reviewed-by: Eike Ziller --- src/plugins/coreplugin/dialogs/settingsdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp index b2e4b9e969f..74fe67d8175 100644 --- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp +++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp @@ -790,7 +790,7 @@ bool SettingsDialog::execDialog() ICore::settings()->setValueWithDefault(kPreferenceDialogSize, size(), initialSize); // make sure that the current "single" instance is deleted // we can't delete right away, since we still access the m_applied member - deleteLater(); + QMetaObject::invokeMethod(this, [this] { deleteLater(); }, Qt::QueuedConnection); }); }