Commit 2d3a7d43 authored by Eike Ziller's avatar Eike Ziller
Browse files

Avoid having current editor that is not in a view.



Was triggering soft assert when opening a session with multiple files
open, and then closing the first one.

Change-Id: I23a503904222b0126dc36d8b2dcc64021393b45c
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 2753ca94
......@@ -1028,6 +1028,11 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
if (EditorView *view = viewForEditor(editor)) {
if (editor == view->currentEditor())
closedViews += view;
if (d->m_currentEditor == editor) {
// avoid having a current editor without view
setCurrentView(view);
setCurrentEditor(0);
}
view->removeEditor(editor);
}
}
......@@ -1494,9 +1499,7 @@ IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QStri
// back to the default editor:
if (!editor)
editor = createEditor(Id(), fn);
if (!editor) // Internal error
return 0;
QTC_ASSERT(editor, return 0);
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QString errorString;
if (!editor->open(&errorString, fn, realFn)) {
......
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