From 9826f7f2053d71d6fffc6683e74f9468b1d8ca88 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Thu, 19 Sep 2019 14:05:47 -0400
Subject: [PATCH] jamiaccount: capture accountId to avoid bad_weak_ptr

Change-Id: I9321ffb6e409750609a7e7744bfe0f7437d5ffd3
---
 src/jamidht/jamiaccount.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp
index f9e5a36697..1560cf5a37 100644
--- a/src/jamidht/jamiaccount.cpp
+++ b/src/jamidht/jamiaccount.cpp
@@ -1028,8 +1028,8 @@ JamiAccount::loadAccount(const std::string& archive_password, const std::string&
             {
                 JAMI_WARN("Auth error: %d %s", (int)error, message.c_str());
                 setRegistrationState(RegistrationState::ERROR_GENERIC);
-                runOnMainThread([w = weak()] {
-                    Manager::instance().removeAccount(w.lock()->getAccountID(), true);
+                runOnMainThread([id = getAccountID()] {
+                    Manager::instance().removeAccount(id, true);
                 });
             }, std::move(callbacks));
         }
-- 
GitLab