summary refs log tree commit diff
path: root/src/ChatPage.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-05-30 00:23:57 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-05-30 00:23:57 +0200
commit18ff58edb3bc186e2114efad34de7ffca803be02 (patch)
tree2e312b1812bda001ca2c68a48cf7cf9711a93e69 /src/ChatPage.cpp
parentFix warning (diff)
downloadnheko-18ff58edb3bc186e2114efad34de7ffca803be02.tar.xz
Fix use after free from Qml widget
Diffstat (limited to '')
-rw-r--r--src/ChatPage.cpp8
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,