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()
209
209
// using the other before destroying them.
210
210
if (peerLogic) UnregisterValidationInterface (peerLogic.get ());
211
211
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 ();
217
213
218
214
StopTorControl ();
219
215
@@ -222,6 +218,12 @@ void Shutdown()
222
218
threadGroup.interrupt_all ();
223
219
threadGroup.join_all ();
224
220
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
+
225
227
if (g_is_mempool_loaded && gArgs .GetArg (" -persistmempool" , DEFAULT_PERSIST_MEMPOOL)) {
226
228
DumpMempool ();
227
229
}
You can’t perform that action at this time.
0 commit comments