Only save eventId in MessageContentModel

Turns out trying to manage pointers in the model is a bad idea so only save eventId in MessageContentModel, events pointers will now only be obtained temporarily then discarded to avoid both creating additional copies of the event in the model and potential sources of crashes.

This also creates a basic unit test that we can add to going forward.
This commit is contained in:
James Graham
2024-09-15 08:28:46 +00:00
parent e0c3b7f808
commit ec6a8dd028
8 changed files with 299 additions and 210 deletions

View File

@@ -1768,6 +1768,9 @@ QByteArray NeoChatRoom::roomAcountDataJson(const QString &eventType)
void NeoChatRoom::downloadEventFromServer(const QString &eventId)
{
if (findInTimeline(eventId) != historyEdge()) {
// For whatever reason the event has now appeared so the function that called
// this need to whatever it wanted to do with the event.
Q_EMIT extraEventLoaded(eventId);
return;
}
auto job = connection()->callApi<GetOneRoomEventJob>(id(), eventId);