From 9bd25cdd6631260b4018f841c2341e2942b2a205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Wed, 29 Jul 2020 17:08:04 -0400 Subject: [PATCH] jamiaccount: register on main thread Change-Id: Iafca382f1b76ae3c77fc3613315c0f664647bdf6 --- src/jamidht/jamiaccount.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index 9b7eac1bd8..6c1d7c166f 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -1652,8 +1652,12 @@ JamiAccount::registerAsyncOps() { auto onLoad = [this, loaded = std::make_shared<std::atomic_uint>()]{ if (++(*loaded) == 2u) { - std::lock_guard<std::mutex> lock(configurationMutex_); - doRegister_(); + runOnMainThread([w = weak()]{ + if (auto s = w.lock()) { + std::lock_guard<std::mutex> lock(s->configurationMutex_); + s->doRegister_(); + } + }); } }; -- GitLab