@@ -339,14 +339,15 @@ static void registerSignalHandler(int signal, void(*handler)(int))
339
339
}
340
340
#endif
341
341
342
+ static boost::signals2::connection rpc_notify_block_change_connection;
342
343
static void OnRPCStarted ()
343
344
{
344
- uiInterface.NotifyBlockTip_connect (&RPCNotifyBlockChange);
345
+ rpc_notify_block_change_connection = uiInterface.NotifyBlockTip_connect (&RPCNotifyBlockChange);
345
346
}
346
347
347
348
static void OnRPCStopped ()
348
349
{
349
- uiInterface. NotifyBlockTip_disconnect (&RPCNotifyBlockChange );
350
+ rpc_notify_block_change_connection. disconnect ( );
350
351
RPCNotifyBlockChange (false , nullptr );
351
352
g_best_block_cv.notify_all ();
352
353
LogPrint (BCLog::RPC, " RPC stopped.\n " );
@@ -1687,8 +1688,9 @@ bool AppInitMain(InitInterfaces& interfaces)
1687
1688
1688
1689
// Either install a handler to notify us when genesis activates, or set fHaveGenesis directly.
1689
1690
// No locking, as this happens before any background thread is started.
1691
+ boost::signals2::connection block_notify_genesis_wait_connection;
1690
1692
if (chainActive.Tip () == nullptr ) {
1691
- uiInterface.NotifyBlockTip_connect (BlockNotifyGenesisWait);
1693
+ block_notify_genesis_wait_connection = uiInterface.NotifyBlockTip_connect (BlockNotifyGenesisWait);
1692
1694
} else {
1693
1695
fHaveGenesis = true ;
1694
1696
}
@@ -1712,7 +1714,7 @@ bool AppInitMain(InitInterfaces& interfaces)
1712
1714
while (!fHaveGenesis && !ShutdownRequested ()) {
1713
1715
g_genesis_wait_cv.wait_for (lock, std::chrono::milliseconds (500 ));
1714
1716
}
1715
- uiInterface. NotifyBlockTip_disconnect (BlockNotifyGenesisWait );
1717
+ block_notify_genesis_wait_connection. disconnect ( );
1716
1718
}
1717
1719
1718
1720
if (ShutdownRequested ()) {
0 commit comments