From 81b6d940218a212a37e3c600c66fbe9a7476f433 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 26 Feb 2017 19:35:09 +0900 Subject: Room: Make sure an event with the same id isn't added twice to the timeline; forbid empty event id's Added assertions and enhanced debug messages along the way --- jobs/roommessagesjob.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'jobs/roommessagesjob.cpp') diff --git a/jobs/roommessagesjob.cpp b/jobs/roommessagesjob.cpp index 1e53f601..7a0bc756 100644 --- a/jobs/roommessagesjob.cpp +++ b/jobs/roommessagesjob.cpp @@ -28,7 +28,7 @@ class RoomMessagesJob::Private public: Private() {} - Events events; + Owning events; QString end; }; @@ -49,9 +49,9 @@ RoomMessagesJob::~RoomMessagesJob() delete d; } -Events RoomMessagesJob::events() +Events RoomMessagesJob::releaseEvents() { - return d->events; + return d->events.release(); } QString RoomMessagesJob::end() @@ -62,7 +62,7 @@ QString RoomMessagesJob::end() BaseJob::Status RoomMessagesJob::parseJson(const QJsonDocument& data) { QJsonObject obj = data.object(); - d->events = eventsFromJson(obj.value("chunk").toArray()); + d->events.assign(eventsFromJson(obj.value("chunk").toArray())); d->end = obj.value("end").toString(); return Success; } -- cgit v1.2.3