From 45d9654fd9c8c7b3e1e11b49bbdd2cc943eea1ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Wed, 17 May 2023 11:32:05 -0400
Subject: [PATCH] conversation: pass shared_ptr to asio tasks

Else, destruction of the object can occurs during a async task
causing weird crashes.

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

diff --git a/src/jamidht/conversation.cpp b/src/jamidht/conversation.cpp
index b3f5e5db19..b43206ae8a 100644
--- a/src/jamidht/conversation.cpp
+++ b/src/jamidht/conversation.cpp
@@ -1842,7 +1842,7 @@ Conversation::checkBootstrapMember(const asio::error_code& ec,
                 sthis->pimpl_->fallbackTimer_->expires_at(std::chrono::steady_clock::now());
                 sthis->pimpl_->fallbackTimer_->async_wait(
                     std::bind(&Conversation::checkBootstrapMember,
-                              sthis.get(),
+                              sthis,
                               std::placeholders::_1,
                               std::move(members)));
             }
@@ -1904,7 +1904,7 @@ Conversation::bootstrap(std::function<void()> onBootstraped)
             sthis->pimpl_->fallbackTimer_->expires_at(std::chrono::steady_clock::now() + 20s
                                                       - std::chrono::seconds(timeForBootstrap));
             sthis->pimpl_->fallbackTimer_->async_wait(std::bind(&Conversation::checkBootstrapMember,
-                                                                sthis.get(),
+                                                                sthis,
                                                                 std::placeholders::_1,
                                                                 std::move(members)));
         });
-- 
GitLab