forked from qt-creator/qt-creator
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: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
f500c4c987
commit
afa66ab9c7
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user