From 1411d28b813c5e5ab2adec0852fd2b771da2c531 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Sat, 6 Feb 2021 01:13:36 +0100 Subject: [PATCH] Fix crash when logging out and back in we get the platformtheme attached property from a random user object, but that user is destroyed when logging out. Instead use the controller as parent since that survives the logout --- src/neochatuser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/neochatuser.cpp b/src/neochatuser.cpp index 690b5eb01..9c403566f 100644 --- a/src/neochatuser.cpp +++ b/src/neochatuser.cpp @@ -10,13 +10,15 @@ #include "csapi/profile.h" +#include "controller.h" + static Kirigami::PlatformTheme * s_theme = nullptr; NeoChatUser::NeoChatUser(QString userId, Connection *connection) : User(std::move(userId), connection) { if (!s_theme) { - s_theme = static_cast(qmlAttachedPropertiesObject(this, true)); + s_theme = static_cast(qmlAttachedPropertiesObject(&Controller::instance(), true)); Q_ASSERT(s_theme); }