diff --git a/src/init.cpp b/src/init.cpp index b0febe3c4..a7612b201 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -255,6 +255,10 @@ void PrepareShutdown() MapPort(false); UnregisterValidationInterface(peerLogic.get()); peerLogic.reset(); + if (g_connman) { + // make sure to stop all threads before g_connman is reset to nullptr as these threads might still be accessing it + g_connman->Stop(); + } g_connman.reset(); if (!fLiteMode && !fRPCInWarmup) {