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 <eike.ziller@qt.io>
This commit is contained in:
Cristian Adam
2024-06-12 16:17:23 +02:00
parent d074f1a9b4
commit bd6e47ce46

View File

@@ -790,7 +790,7 @@ bool SettingsDialog::execDialog()
ICore::settings()->setValueWithDefault(kPreferenceDialogSize, size(), initialSize); ICore::settings()->setValueWithDefault(kPreferenceDialogSize, size(), initialSize);
// make sure that the current "single" instance is deleted // make sure that the current "single" instance is deleted
// we can't delete right away, since we still access the m_applied member // we can't delete right away, since we still access the m_applied member
deleteLater(); QMetaObject::invokeMethod(this, [this] { deleteLater(); }, Qt::QueuedConnection);
}); });
} }