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 <robert.loehning@theqtcompany.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
Eike Ziller
2015-10-23 12:03:43 +02:00
parent 2c3f3970d5
commit d6f23d362e

View File

@@ -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