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: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Petar Perisin <petar.perisin@gmail.com>
This commit is contained in:
Orgad Shaneh
2013-09-20 17:53:49 +03:00
committed by Orgad Shaneh
parent 8b7dff6fdc
commit 243a625961

View File

@@ -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())