summary refs log tree commit diff
path: root/src/ChatPage.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@ymail.com>2022-04-08 03:24:10 +0200
committerNicolas Werner <nicolas.werner@ymail.com>2022-04-08 03:24:10 +0200
commitf316dbed439c2dea2c570d6cab1f694f6df6df6f (patch)
tree2fd2e4123dffaa7946033cc46e352aca505e6d1a /src/ChatPage.cpp
parentRemove sender key from megolm session index (diff)
downloadnheko-f316dbed439c2dea2c570d6cab1f694f6df6df6f.tar.xz
Fix a few issues with receiving to_device messages in initial sync
Diffstat (limited to '')
-rw-r--r--src/ChatPage.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp

index 43455e86..0550c7f3 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp
@@ -560,25 +560,26 @@ ChatPage::startInitialSync() } } - nhlog::net()->info("initial sync completed"); - - try { - cache::client()->saveState(res); + QTimer::singleShot(0, this, [this, res] { + nhlog::net()->info("initial sync completed"); + try { + cache::client()->saveState(res); - olm::handle_to_device_messages(res.to_device.events); + olm::handle_to_device_messages(res.to_device.events); - emit initializeViews(std::move(res)); - emit initializeMentions(cache::getTimelineMentions()); + emit initializeViews(std::move(res)); + emit initializeMentions(cache::getTimelineMentions()); - cache::calculateRoomReadStatus(); - } catch (const lmdb::error &e) { - nhlog::db()->error("failed to save state after initial sync: {}", e.what()); - startInitialSync(); - return; - } + cache::calculateRoomReadStatus(); + } catch (const lmdb::error &e) { + nhlog::db()->error("failed to save state after initial sync: {}", e.what()); + startInitialSync(); + return; + } - emit trySyncCb(); - emit contentLoaded(); + emit trySyncCb(); + emit contentLoaded(); + }); }); }