diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp
index f425ef2e7440eabb76160c9a2ebf74645b17f42b..37becf7409ad0c6f6e1dcde6ea6480c4911f466f 100644
--- a/src/connectionmanager.cpp
+++ b/src/connectionmanager.cpp
@@ -749,14 +749,12 @@ ConnectionManager::Impl::connectDeviceOnNegoDone(
     info->tls_->setOnReady(
         [w = weak_from_this(), dinfo, winfo=std::weak_ptr(info), deviceId = std::move(deviceId), vid = std::move(vid), name = std::move(name)](
             bool ok) {
-            if (auto shared = w.lock()) {
+            if (auto shared = w.lock())
                 if (auto info = winfo.lock()) {
                     shared->onTlsNegotiationDone(dinfo.lock(), info, ok, deviceId, vid, name);
-                    // Make sure there's another reference to info to avoid destruction when
-                    // we leave this scope (would lead to a deadlock on cbMtx_).
+                    // Make another reference to info to avoid destruction (could lead to a deadlock/crash).
                     dht::ThreadPool::io().run([info = std::move(info)] {});
                 }
-            }
         });
     return true;
 }
@@ -1355,7 +1353,11 @@ ConnectionManager::Impl::onRequestOnNegoDone(const std::weak_ptr<DeviceInfo>& di
     info->tls_->setOnReady(
         [w = weak_from_this(), dinfo, winfo=std::weak_ptr(info), deviceId = std::move(deviceId), vid = std::move(req.id)](bool ok) {
             if (auto shared = w.lock())
-                shared->onTlsNegotiationDone(dinfo.lock(), winfo.lock(), ok, deviceId, vid);
+                if (auto info = winfo.lock()) {
+                    shared->onTlsNegotiationDone(dinfo.lock(), winfo.lock(), ok, deviceId, vid);
+                    // Make another reference to info to avoid destruction (could lead to a deadlock/crash).
+                    dht::ThreadPool::io().run([info = std::move(info)] {});
+                }
         });
     return true;
 }