Commit 243a6259 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

EditorManager: Fix crash when closing an editor upon activation

* activateEditor receives a pointer to the editor.
* When currentEditorChanged is emitted (using a direct connection),
  closeEditor is called (because changes were reverted and the editor
  isn't needed anymore.
* closeEditor eventually deletes the editor
* Control is returned to activateEditor, which now references a deleted
  editor -> crash

Task-number: QTCREATORBUG-10190
Change-Id: I9062f03c1c1550f0a8c0c49c226dedcfd252eb12
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
Reviewed-by: default avatarPetar Perisin <petar.perisin@gmail.com>
parent 8b7dff6f
...@@ -1161,9 +1161,8 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask ...@@ -1161,9 +1161,8 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
emit editorsClosed(acceptedEditors); emit editorsClosed(acceptedEditors);
foreach (IEditor *editor, acceptedEditors) { foreach (IEditor *editor, acceptedEditors)
delete editor; editor->deleteLater();
}
if (currentView) { if (currentView) {
if (IEditor *editor = currentView->currentEditor()) if (IEditor *editor = currentView->currentEditor())
......
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