forked from qt-creator/qt-creator
Fix crash on close in sidebar/bookmarks view
Explicitly close all views of the sidebar _before_ the core is destructed. E.g. the bookmarks view tries to access the core in it's destructor.
This commit is contained in:
@@ -283,9 +283,6 @@ MainWindow::~MainWindow()
|
||||
delete m_rightPaneWidget;
|
||||
m_rightPaneWidget = 0;
|
||||
|
||||
delete m_navigationWidget;
|
||||
m_navigationWidget = 0;
|
||||
|
||||
delete m_modeManager;
|
||||
m_modeManager = 0;
|
||||
delete m_mimeDatabase;
|
||||
@@ -366,7 +363,11 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
}
|
||||
|
||||
emit m_coreImpl->coreAboutToClose();
|
||||
|
||||
writeSettings();
|
||||
|
||||
m_navigationWidget->closeSubWidgets();
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
|
||||
@@ -340,6 +340,15 @@ void NavigationWidget::restoreSettings(QSettings *settings)
|
||||
}
|
||||
}
|
||||
|
||||
void NavigationWidget::closeSubWidgets()
|
||||
{
|
||||
foreach (NavigationSubWidget *subWidget, m_subWidgets) {
|
||||
subWidget->saveSettings();
|
||||
delete subWidget;
|
||||
}
|
||||
m_subWidgets.clear();
|
||||
}
|
||||
|
||||
void NavigationWidget::setShown(bool b)
|
||||
{
|
||||
if (m_shown == b)
|
||||
|
||||
@@ -92,6 +92,8 @@ public:
|
||||
void saveSettings(QSettings *settings);
|
||||
void restoreSettings(QSettings *settings);
|
||||
|
||||
void closeSubWidgets();
|
||||
|
||||
bool isShown() const;
|
||||
void setShown(bool b);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user