forked from qt-creator/qt-creator
Fix crash after closing preferences opened from indexing progress
The preferences dialog is modal and creates an event loop that would be running within the mouse event handler of the widget. When the dialog is closed after the widget is destroyed (i.e. after indexing finished), control would be passed back to the destroyed widget, and crash. Fixes: QTCREATORBUG-28566 Change-Id: I71efa683822b5682ad1b38c39ce8f73c89bdd610 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -394,7 +394,12 @@ ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir)
|
||||
project ? tr("Indexing %1 with clangd").arg(project->displayName())
|
||||
: tr("Indexing session with clangd"));
|
||||
setClickHandlerForToken(indexingToken(), [] {
|
||||
ICore::showOptionsDialog(CppEditor::Constants::CPP_CLANGD_SETTINGS_ID);
|
||||
// don't directly open modal dialog from click handler, because that would mess
|
||||
// up the stack
|
||||
QMetaObject::invokeMethod(
|
||||
ICore::instance(),
|
||||
[] { ICore::showOptionsDialog(CppEditor::Constants::CPP_CLANGD_SETTINGS_ID); },
|
||||
Qt::QueuedConnection);
|
||||
});
|
||||
setCurrentProject(project);
|
||||
setDocumentChangeUpdateThreshold(d->settings.documentUpdateThreshold);
|
||||
|
||||
Reference in New Issue
Block a user