forked from qt-creator/qt-creator
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: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user