From 79deda4f2dfccf14a735109ace520542dfdf6e7c Mon Sep 17 00:00:00 2001 From: James Graham Date: Tue, 15 Oct 2024 16:54:19 +0100 Subject: [PATCH] Make sure that content is kept alive so fileInfo can be used throughout the function --- src/eventhandler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/eventhandler.cpp b/src/eventhandler.cpp index 32813dcb6..ec1b2bd99 100644 --- a/src/eventhandler.cpp +++ b/src/eventhandler.cpp @@ -704,7 +704,8 @@ QVariantMap EventHandler::getMediaInfoForEvent(const NeoChatRoom *room, const Qu } const EventContent::FileInfo *fileInfo; - fileInfo = roomMessageEvent->content()->fileInfo(); + const auto content = roomMessageEvent->content(); + fileInfo = content->fileInfo(); QVariantMap mediaInfo = getMediaInfoFromFileInfo(room, fileInfo, eventId, false, false); // if filename isn't specifically given, it is in body // https://spec.matrix.org/latest/client-server-api/#mfile