Commit b5601105 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Fixed crash when trying to activate a no longer existing editor

This could happen when using Ctrl+Tab to switch editors, and while
holding Ctrl you close an editor with Ctrl+W, and then you try to select

Since the crash was due to an assertion, we can just avoid it by doing
nothing when no editor for the given file is found.

Reviewed-by: mae
Task-number: QTCREATOR-190
parent 16ff6ac7
......@@ -713,7 +713,7 @@ void EditorManager::closeEditor(const QModelIndex &index)
bool EditorManager::closeEditors(const QList<IEditor*> editorsToClose, bool askAboutModifiedEditors)
bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool askAboutModifiedEditors)
if (editorsToClose.isEmpty())
return true;
......@@ -939,8 +939,10 @@ Core::IEditor *EditorManager::activateEditor(Core::Internal::EditorView *view, C
Core::IEditor *EditorManager::activateEditor(Core::Internal::EditorView *view, Core::IFile *file, OpenEditorFlags flags)
QList<IEditor*> editors = editorsForFile(file);
const QList<IEditor*> editors = editorsForFile(file);
if (editors.isEmpty())
return 0;
return activateEditor(view, editors.first(), flags);
......@@ -151,7 +151,7 @@ public:
bool saveEditor(IEditor *editor);
bool closeEditors(const QList<IEditor *> editorsToClose, bool askAboutModifiedEditors = true);
bool closeEditors(const QList<IEditor *> &editorsToClose, bool askAboutModifiedEditors = true);
MakeWritableResult makeEditorWritable(IEditor *editor);
......@@ -242,7 +242,7 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE
first = false;
// add purely restored editors which are not initialised yet
foreach (const OpenEditorsModel::Entry &entry, model->entries()) {
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