File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -209,11 +209,7 @@ void Shutdown()
209209 // using the other before destroying them.
210210 if (peerLogic) UnregisterValidationInterface (peerLogic.get ());
211211 if (g_connman) g_connman->Stop ();
212- peerLogic.reset ();
213- g_connman.reset ();
214- if (g_txindex) {
215- g_txindex.reset ();
216- }
212+ if (g_txindex) g_txindex->Stop ();
217213
218214 StopTorControl ();
219215
@@ -222,6 +218,12 @@ void Shutdown()
222218 threadGroup.interrupt_all ();
223219 threadGroup.join_all ();
224220
221+ // After the threads that potentially access these pointers have been stopped,
222+ // destruct and reset all to nullptr.
223+ peerLogic.reset ();
224+ g_connman.reset ();
225+ g_txindex.reset ();
226+
225227 if (g_is_mempool_loaded && gArgs .GetArg (" -persistmempool" , DEFAULT_PERSIST_MEMPOOL)) {
226228 DumpMempool ();
227229 }
You can’t perform that action at this time.
0 commit comments