diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-04-23 13:02:18 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-04-23 13:03:41 -0400 |
commit | 4bd7187da81767ecb8aadcb86c9e53dc8636695f (patch) | |
tree | accea5493f913680ba3ba3ce263909ecadea318d /src/init.cpp | |
parent | e9e777e21b42b3f4d5aef1650d72036e72170ba2 (diff) | |
parent | 6dd469a3bea60d8857ec0be625c2ef8a7716c148 (diff) |
Merge #15699: Remove no-op CClientUIInterface::[signal_name]_disconnect. Disconnect BlockNotifyGenesisWait and RPCNotifyBlockChange properly.
6dd469a3be Disconnect BlockNotifyGenesisWait and RPCNotifyBlockChange properly. Remove no-op CClientUIInterface::[signal_name]_disconnect. (practicalswift)
Pull request description:
Resolves #15698.
Changes:
* Remove no-op `CClientUIInterface::[signal_name]_disconnect`.
* Disconnect `BlockNotifyGenesisWait` and `RPCNotifyBlockChange` properly.
ACKs for commit 6dd469:
MarcoFalke:
utACK 6dd469a3bea60d8857ec0be625c2ef8a7716c148
Tree-SHA512: 0b50d658fa72261332bc57ddea379fd08f4bc1de392c10c628e20142d6fd244b606c39fd0665d6bc39324c1aa8c8814ac942b4659106279e33b90206aaf37411
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/init.cpp b/src/init.cpp index e072b494c2..c639763432 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -345,14 +345,15 @@ static void registerSignalHandler(int signal, void(*handler)(int)) } #endif +static boost::signals2::connection rpc_notify_block_change_connection; static void OnRPCStarted() { - uiInterface.NotifyBlockTip_connect(&RPCNotifyBlockChange); + rpc_notify_block_change_connection = uiInterface.NotifyBlockTip_connect(&RPCNotifyBlockChange); } static void OnRPCStopped() { - uiInterface.NotifyBlockTip_disconnect(&RPCNotifyBlockChange); + rpc_notify_block_change_connection.disconnect(); RPCNotifyBlockChange(false, nullptr); g_best_block_cv.notify_all(); LogPrint(BCLog::RPC, "RPC stopped.\n"); @@ -1733,8 +1734,9 @@ bool AppInitMain(InitInterfaces& interfaces) // Either install a handler to notify us when genesis activates, or set fHaveGenesis directly. // No locking, as this happens before any background thread is started. + boost::signals2::connection block_notify_genesis_wait_connection; if (chainActive.Tip() == nullptr) { - uiInterface.NotifyBlockTip_connect(BlockNotifyGenesisWait); + block_notify_genesis_wait_connection = uiInterface.NotifyBlockTip_connect(BlockNotifyGenesisWait); } else { fHaveGenesis = true; } @@ -1758,7 +1760,7 @@ bool AppInitMain(InitInterfaces& interfaces) while (!fHaveGenesis && !ShutdownRequested()) { g_genesis_wait_cv.wait_for(lock, std::chrono::milliseconds(500)); } - uiInterface.NotifyBlockTip_disconnect(BlockNotifyGenesisWait); + block_notify_genesis_wait_connection.disconnect(); } if (ShutdownRequested()) { |