1 files changed, 8 insertions, 0 deletions
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp
index 4ad7bd14..0f16f205 100644
--- a/src/ChatPage.cpp
+++ b/src/ChatPage.cpp
@@ -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,
|