diff --git a/src/jamidht/conversation.cpp b/src/jamidht/conversation.cpp index 335f18271cedf836fa7327158d2c484996ad4a73..045fdb600b5748a227720d4a189ca51d605d9b1d 100644 --- a/src/jamidht/conversation.cpp +++ b/src/jamidht/conversation.cpp @@ -2307,10 +2307,12 @@ void Conversation::onNeedSocket(NeedSocketCb needSocket) { pimpl_->swarmManager_->needSocketCb_ = [needSocket = std::move(needSocket), - this](const std::string& deviceId, ChannelCb&& cb) { - return needSocket(id(), deviceId, std::move(cb), "application/im-gitmessage-id"); + w=weak()](const std::string& deviceId, ChannelCb&& cb) { + if (auto sthis = w.lock()) + needSocket(sthis->id(), deviceId, std::move(cb), "application/im-gitmessage-id"); }; } + void Conversation::addSwarmChannel(std::shared_ptr<dhtnet::ChannelSocket> channel) {