Commit ee52fd4b authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Be more defensive when tearing down

- Move the original m_toolviews as it gets modified on destruction
- Use QPointer for storing toolviews
parent 468d6cdc
Pipeline #255529 canceled with stage
......@@ -1322,8 +1322,10 @@ MainWindow::MainWindow(QWidget *parentWidget)
MainWindow::~MainWindow()
{
// cu toolviews
qDeleteAll(m_toolviews);
// move toolviews as deleting them will
// modify m_toolviews. see toolViewDeleted
auto toolviews = m_toolviews;
qDeleteAll(toolviews);
// seems like we really should delete this by hand ;)
delete m_centralWidget;
......
......@@ -589,12 +589,12 @@ private:
/**
* map identifiers to widgets
*/
std::map<QString, ToolView *> m_idToWidget;
std::map<QString, QPointer<ToolView>> m_idToWidget;
/**
* list of all toolviews around
*/
std::vector<ToolView *> m_toolviews;
std::vector<QPointer<ToolView>> m_toolviews;
/**
* widget, which is the central part of the
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment