Skip to content

Commit 0f832e3

Browse files
MarcoFalkefurszy
authored andcommitted
shutdown: Stop threads before resetting ptrs
1 parent 67aebbf commit 0f832e3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/init.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,6 @@ void PrepareShutdown()
237237
// using the other before destroying them.
238238
if (peerLogic) UnregisterValidationInterface(peerLogic.get());
239239
if (g_connman) g_connman->Stop();
240-
peerLogic.reset();
241-
g_connman.reset();
242240

243241
StopTorControl();
244242

@@ -247,6 +245,11 @@ void PrepareShutdown()
247245
threadGroup.interrupt_all();
248246
threadGroup.join_all();
249247

248+
// After the threads that potentially access these pointers have been stopped,
249+
// destruct and reset all to nullptr.
250+
peerLogic.reset();
251+
g_connman.reset();
252+
250253
DumpMasternodes();
251254
DumpBudgets(g_budgetman);
252255
DumpMasternodePayments();

0 commit comments

Comments
 (0)