From 91778a298b6af24f2836ca95ff68edad550ec980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= Date: Mon, 7 Feb 2022 15:15:21 -0500 Subject: [PATCH] jamiaccount: do not emit signals during authentification callbacks from OnChangeCallback are called during account's initialization. This will triggers signals that the client will already retrieve via dedicated methods and those signals are emitted when the account is not usable (accountManager or id_ not initialized). Change-Id: I8d16c077bbf8b827c91be9047b202cd5e859167a --- src/jamidht/jamiaccount.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index 79bf286fd..c10eb940a 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -1113,11 +1113,15 @@ JamiAccount::loadAccount(const std::string& archive_password, JAMI_DBG("[Account %s] loading account", getAccountID().c_str()); AccountManager::OnChangeCallback callbacks { [this](const std::string& uri, bool confirmed) { + if (!id_.first) + return; runOnMainThread([id = getAccountID(), uri, confirmed] { emitSignal(id, uri, confirmed); }); }, [this](const std::string& uri, bool banned) { + if (!id_.first) + return; runOnMainThread([id = getAccountID(), uri, banned] { emitSignal(id, uri, banned); }); @@ -1126,6 +1130,8 @@ JamiAccount::loadAccount(const std::string& archive_password, const std::string& conversationId, const std::vector& payload, time_t received) { + if (!id_.first) + return; if (conversationId.empty()) { // Old path emitSignal(getAccountID(), @@ -2303,7 +2309,8 @@ ConversationModule* JamiAccount::convModule() { if (!accountManager() || currentDeviceId() == "") { - JAMI_ERR() << "Calling convModule() with an uninitialized account."; + JAMI_ERR("[Account %s] Calling convModule() with an uninitialized account", + getAccountID().c_str()); return nullptr; } std::lock_guard lk(moduleMtx_);