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
This commit is contained in:
Nicolas Fella
2021-02-06 01:13:36 +01:00
committed by Tobias Fella
parent 6dcfad1f8d
commit 1411d28b81

View File

@@ -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<Kirigami::PlatformTheme *>(qmlAttachedPropertiesObject<Kirigami::PlatformTheme>(this, true));
s_theme = static_cast<Kirigami::PlatformTheme *>(qmlAttachedPropertiesObject<Kirigami::PlatformTheme>(&Controller::instance(), true));
Q_ASSERT(s_theme);
}