forked from qt-creator/qt-creator
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user