From 5ca1fb18bbf9789a65eaf3113ee1ff65449ff086 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 7 Nov 2021 03:38:48 +0100 Subject: Move away from using an event loop to access secrets Fixes messages in room flickering and being stuck fixes #760 relates to #770 relates to #789 --- src/encryption/SelfVerificationStatus.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/encryption/SelfVerificationStatus.cpp') diff --git a/src/encryption/SelfVerificationStatus.cpp b/src/encryption/SelfVerificationStatus.cpp index bbfb6f9c..32386fdb 100644 --- a/src/encryption/SelfVerificationStatus.cpp +++ b/src/encryption/SelfVerificationStatus.cpp @@ -259,15 +259,20 @@ SelfVerificationStatus::invalidate() using namespace mtx::secret_storage; nhlog::db()->info("Invalidating self verification status"); + if (cache::isInitialized()) { + return; + } + this->hasSSSS_ = false; emit hasSSSSChanged(); auto keys = cache::client()->userKeys(http::client()->user_id().to_string()); if (!keys || keys->device_keys.find(http::client()->device_id()) == keys->device_keys.end()) { - cache::client()->markUserKeysOutOfDate({http::client()->user_id().to_string()}); - cache::client()->query_keys(http::client()->user_id().to_string(), - [](const UserKeyCache &, mtx::http::RequestErr) {}); - return; + QTimer::singleShot(500, [] { + cache::client()->markUserKeysOutOfDate({http::client()->user_id().to_string()}); + cache::client()->query_keys(http::client()->user_id().to_string(), + [](const UserKeyCache &, mtx::http::RequestErr) {}); + }); } if (keys->master_keys.keys.empty()) { -- cgit 1.5.1