From 6079fe65110be6160feb3fee3a2c7252ccbd88e7 Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Fri, 1 Mar 2019 08:24:54 +0100 Subject: [PATCH] Stop g_connman first before deleting it --- src/init.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index b0febe3c4069..a7612b201f22 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) {