Fix crash on shutdown and simplify code

This commit is contained in:
Tobias Fella
2025-08-22 18:04:42 +02:00
parent 1c7cc45d8e
commit 0fa490f532
2 changed files with 3 additions and 6 deletions

View File

@@ -3,6 +3,8 @@
#include "messagecontentmodel.h"
#include <QStyleHints>
#include <KLocalizedString>
#include "chatbarcache.h"
@@ -18,10 +20,7 @@ MessageContentModel::MessageContentModel(NeoChatRoom *room, MessageContentModel
, m_room(room)
, m_eventId(eventId)
{
m_theme = static_cast<Kirigami::Platform::PlatformTheme *>(qmlAttachedPropertiesObject<Kirigami::Platform::PlatformTheme>(this, true));
if (m_theme) {
connect(m_theme, &Kirigami::Platform::PlatformTheme::colorsChanged, this, &MessageContentModel::updateSpoilers);
}
connect(qGuiApp->styleHints(), &QStyleHints::colorSchemeChanged, this, &MessageContentModel::updateSpoilers);
initializeModel();
}