From 280545fdf89fe92b6f2b6b28e2c4d86c862c3d71 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 11 Mar 2021 16:09:18 +0100 Subject: Editors: Fix soft assert about empty currentView We need to always either have a current view or a current editor. Make sure we set the current view if we end up without a current editor when closing files. Amends ee1e6ca50821ace4323a0838452dda59b1a352a2 Fixes: QTCREATORBUG-24869 Change-Id: I9e1982697700079e037695e100ef71eadaf7849f Reviewed-by: David Schulz --- src/plugins/coreplugin/editormanager/editormanager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 36c1ae3634..f45b49ae1b 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1743,10 +1743,12 @@ bool EditorManagerPrivate::closeEditors(const QList &editors, CloseFla foreach (IEditor *editor, acceptedEditors) delete editor; - if (focusView) + if (focusView) { activateView(focusView); - else + } else { + setCurrentView(currentView); setCurrentEditor(currentView->currentEditor()); + } if (!EditorManager::currentEditor()) { emit m_instance->currentEditorChanged(nullptr); -- cgit v1.2.3