Commit afa66ab9 authored by Erik Verbruggen's avatar Erik Verbruggen Committed by Nikolai Kosjar

C++: fix potential deadlock when closing an editor

When the editor is closed, the CppEditorSupport waits for the
highlighting and semantic info futures to finish. These futures might
access the CppEditorSupport through the CppModelManager, causing a
deadlock on the m_editorSupportMutex.

Change-Id: Ifeb3864ed3bc2666d83607ef50d7bfee8f3d118f
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent f500c4c9
......@@ -615,9 +615,14 @@ void CppModelManager::deleteEditorSupport(TextEditor::BaseTextEditor *textEditor
if (!isCppEditor(textEditor))
return;
QMutexLocker locker(&m_editorSupportMutex);
CppEditorSupport *editorSupport = m_editorSupport.value(textEditor, 0);
m_editorSupport.remove(textEditor);
CppEditorSupport *editorSupport;
{ // only lock the operations on m_editorSupport
QMutexLocker locker(&m_editorSupportMutex);
editorSupport = m_editorSupport.value(textEditor, 0);
m_editorSupport.remove(textEditor);
}
delete editorSupport;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment