Clang: Fix heap-use-after-free in ClangCurrentDocumentFilter

...when closing editors fast (e.g. holding Ctrl+W).

Due to the queued connection the slot was invoked after the deletion of
the editor. There is no point in having a queued connection here, so
remove it.

Task-number: QTCREATORBUG-20191
Change-Id: I3872f8046b56f93c9aac832feccfd911d39e5995
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-05-02 12:09:32 +02:00
parent 44daf5b1e3
commit 4861f5c183

View File

@@ -59,11 +59,9 @@ ClangCurrentDocumentFilter::ClangCurrentDocumentFilter()
Core::EditorManager *editorManager = Core::EditorManager::instance(); Core::EditorManager *editorManager = Core::EditorManager::instance();
connect(editorManager, &Core::EditorManager::currentEditorChanged, connect(editorManager, &Core::EditorManager::currentEditorChanged,
this, &ClangCurrentDocumentFilter::onCurrentEditorChanged, this, &ClangCurrentDocumentFilter::onCurrentEditorChanged);
Qt::QueuedConnection);
connect(editorManager, &Core::EditorManager::editorAboutToClose, connect(editorManager, &Core::EditorManager::editorAboutToClose,
this, &ClangCurrentDocumentFilter::onEditorAboutToClose, this, &ClangCurrentDocumentFilter::onEditorAboutToClose);
Qt::QueuedConnection);
} }
static QString addType(const QString &signature, const ClangBackEnd::ExtraInfo &extraInfo) static QString addType(const QString &signature, const ClangBackEnd::ExtraInfo &extraInfo)