From 0f6506c022ff1ccaa648ff50b81ae29f5a6f2176 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Mon, 14 Feb 2022 08:55:50 +0100 Subject: Connection: guard device loading per-object Using a static variable is incorrect as it doesn't load the device list for any subsequent created Connection object. --- lib/connection.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/connection.cpp b/lib/connection.cpp index 3b8da6d1..0562d416 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -131,6 +131,7 @@ public: #ifdef Quotient_E2EE_ENABLED std::unique_ptr olmAccount; bool isUploadingKeys = false; + bool firstSync = true; #endif // Quotient_E2EE_ENABLED QPointer resolverJob = nullptr; @@ -769,10 +770,9 @@ void Connection::onSyncSuccess(SyncData&& data, bool fromCache) connect(job, &BaseJob::result, this, [this] { d->isUploadingKeys = false; }); } - static bool first = true; - if(first) { + if(d->firstSync) { d->loadDevicesList(); - first = false; + d->firstSync = false; } d->consumeDevicesList(data.takeDevicesList()); -- cgit v1.2.3