From 36fa01f217fbc32afb90314fd257650c71a47045 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 13 Sep 2016 14:42:55 -0400 Subject: [PATCH] net: only delete CConnman if it's been created In the case of (for example) an already-running bitcoind, the shutdown sequence begins before CConnman has been created, leading to a null-pointer dereference when g_connman->Stop() is called. Instead, Just let the CConnman dtor take care of stopping. --- src/init.cpp | 1 - src/net.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index e9552da67..8d1e330a0 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -200,7 +200,6 @@ void Shutdown() pwalletMain->Flush(false); #endif MapPort(false); - g_connman->Stop(); g_connman.reset(); StopTorControl(); diff --git a/src/net.cpp b/src/net.cpp index b39ef9f54..30513a3b9 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2205,6 +2205,7 @@ void CConnman::DeleteNode(CNode* pnode) CConnman::~CConnman() { + Stop(); } size_t CConnman::GetAddressCount() const