From d6f23d362e95850d730a3e385c8a7c4d893ad5d9 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 23 Oct 2015 12:03:43 +0200 Subject: [PATCH] Editors: Fix crash when closing empty editor window Restoring a session removes all "external" editor areas. For simplicity the editor manager only manages the editor areas, not the windows themselves. So an editor window must take care of closing itself when its editor area gets cleaned up. Change-Id: I619f95376ef980d4c318b966427ebf4b2f78ca31 Task-number: QTCREATORBUG-15193 Reviewed-by: Robert Loehning Reviewed-by: David Schulz --- src/plugins/coreplugin/editormanager/editorwindow.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/coreplugin/editormanager/editorwindow.cpp b/src/plugins/coreplugin/editormanager/editorwindow.cpp index 825b22c8636..4117587114f 100644 --- a/src/plugins/coreplugin/editormanager/editorwindow.cpp +++ b/src/plugins/coreplugin/editormanager/editorwindow.cpp @@ -60,13 +60,18 @@ EditorWindow::EditorWindow(QWidget *parent) : connect(m_area, &EditorArea::windowTitleNeedsUpdate, this, &EditorWindow::updateWindowTitle); + // editor area can be deleted by editor manager + connect(m_area, &EditorArea::destroyed, this, [this]() { + m_area = nullptr; + deleteLater(); + }); updateWindowTitle(); } EditorWindow::~EditorWindow() { - disconnect(m_area, &EditorArea::windowTitleNeedsUpdate, - this, &EditorWindow::updateWindowTitle); + if (m_area) + disconnect(m_area, 0, this, 0); } EditorArea *EditorWindow::editorArea() const