Fix use after free from Qml widget
This commit is contained in:
parent
2174f6507f
commit
18ff58edb3
3 changed files with 13 additions and 3 deletions
|
|
@ -171,6 +171,14 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
|
|||
activateWindow();
|
||||
});
|
||||
|
||||
connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, [this]() {
|
||||
// ensure the qml context is shutdown before we destroy all other singletons
|
||||
// Otherwise Qml will try to access the room list or settings, after they have been
|
||||
// destroyed
|
||||
topLayout_->removeWidget(view_manager_->getWidget());
|
||||
delete view_manager_->getWidget();
|
||||
});
|
||||
|
||||
connect(
|
||||
this,
|
||||
&ChatPage::initializeViews,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue