@@ -345,14 +345,15 @@ static void registerSignalHandler(int signal, void(*handler)(int))
345
345
}
346
346
#endif
347
347
348
+ static boost::signals2::connection rpc_notify_block_change_connection;
348
349
static void OnRPCStarted ()
349
350
{
350
- uiInterface.NotifyBlockTip_connect (&RPCNotifyBlockChange);
351
+ rpc_notify_block_change_connection = uiInterface.NotifyBlockTip_connect (&RPCNotifyBlockChange);
351
352
}
352
353
353
354
static void OnRPCStopped ()
354
355
{
355
- uiInterface. NotifyBlockTip_disconnect (&RPCNotifyBlockChange );
356
+ rpc_notify_block_change_connection. disconnect ( );
356
357
RPCNotifyBlockChange (false , nullptr );
357
358
g_best_block_cv.notify_all ();
358
359
LogPrint (BCLog::RPC, " RPC stopped.\n " );
@@ -1733,8 +1734,9 @@ bool AppInitMain(InitInterfaces& interfaces)
1733
1734
1734
1735
// Either install a handler to notify us when genesis activates, or set fHaveGenesis directly.
1735
1736
// No locking, as this happens before any background thread is started.
1737
+ boost::signals2::connection block_notify_genesis_wait_connection;
1736
1738
if (chainActive.Tip () == nullptr ) {
1737
- uiInterface.NotifyBlockTip_connect (BlockNotifyGenesisWait);
1739
+ block_notify_genesis_wait_connection = uiInterface.NotifyBlockTip_connect (BlockNotifyGenesisWait);
1738
1740
} else {
1739
1741
fHaveGenesis = true ;
1740
1742
}
@@ -1758,7 +1760,7 @@ bool AppInitMain(InitInterfaces& interfaces)
1758
1760
while (!fHaveGenesis && !ShutdownRequested ()) {
1759
1761
g_genesis_wait_cv.wait_for (lock, std::chrono::milliseconds (500 ));
1760
1762
}
1761
- uiInterface. NotifyBlockTip_disconnect (BlockNotifyGenesisWait );
1763
+ block_notify_genesis_wait_connection. disconnect ( );
1762
1764
}
1763
1765
1764
1766
if (ShutdownRequested ()) {
0 commit comments