CClientUIInterface::[signal_name]_disconnect is a no-op #15698

issue practicalswift opened this issue on March 29, 2019
  1. practicalswift commented at 6:02 PM on March 29, 2019: contributor

    From what I can tell CClientUIInterface::[signal_name]_disconnect is a no-op.

    In other words calling it does not disconnect the slot:

    For example uiInterface.NotifyBlockTip_disconnect(BlockNotifyGenesisWait); in AppInitMain(...) does not disconnect BlockNotifyGenesisWait as one would expect. The result being that BlockNotifyGenesisWait is invoked for every new block :-)

    Running bitcoind with some debug printing added shows the issue:

    [signals] CClientUIInterface::ThreadSafeMessageBox_connect(...) entered with 0 connected slots.
    [signals] CClientUIInterface::ThreadSafeMessageBox_connect(...) exited with 1 connected slots.
    [signals] CClientUIInterface::ThreadSafeQuestion_connect(...) entered with 0 connected slots.
    [signals] CClientUIInterface::ThreadSafeQuestion_connect(...) exited with 1 connected slots.
    [signals] CClientUIInterface::InitMessage_connect(...) entered with 0 connected slots.
    [signals] CClientUIInterface::InitMessage_connect(...) exited with 1 connected slots.
    [signals] CClientUIInterface::InitMessage_connect(...) entered with 1 connected slots.
    [signals] CClientUIInterface::InitMessage_connect(...) exited with 2 connected slots.
    [signals] Calling uiInterface.NotifyBlockTip_connect(&RPCNotifyBlockChange) in OnRPCStarted()
    [signals] CClientUIInterface::NotifyBlockTip_connect(...) entered with 0 connected slots.
    [signals] CClientUIInterface::NotifyBlockTip_connect(...) exited with 1 connected slots.
    [signals] Calling uiInterface.NotifyBlockTip_connect(BlockNotifyGenesisWait) in AppInitMain(...)
    [signals] CClientUIInterface::NotifyBlockTip_connect(...) entered with 1 connected slots.
    [signals] CClientUIInterface::NotifyBlockTip_connect(...) exited with 2 connected slots.
    [signals] RPCNotifyBlockChange(...) was invoked.
    [signals] BlockNotifyGenesisWait(...) was invoked.
    [signals] Calling uiInterface.NotifyBlockTip_disconnect(BlockNotifyGenesisWait) in AppInitMain(...)
    [signals] CClientUIInterface::NotifyBlockTip_disconnect(...) entered with 2 connected slots.
    [signals] CClientUIInterface::NotifyBlockTip_disconnect(...) exited with 2 connected slots.
    [signals] RPCNotifyBlockChange(...) was invoked.
    [signals] BlockNotifyGenesisWait(...) was invoked.
    [signals] RPCNotifyBlockChange(...) was invoked.
    [signals] BlockNotifyGenesisWait(...) was invoked.
    [signals] RPCNotifyBlockChange(...) was invoked.
    [signals] BlockNotifyGenesisWait(...) was invoked.
    ... and so on ...
    

    Note how BlockNotifyGenesisWait(...) is called also after uiInterface.NotifyBlockTip_disconnect(BlockNotifyGenesisWait).

    I think the problem is that the disconnect(...) member function of boost::signals2::signal expects a function pointer to be passed in (the same that was passed to .connect(...)), but we're doing:

    void CClientUIInterface::signal_name##_disconnect(std::function<signal_name##Sig> fn)
    {
        return g_ui_signals.signal_name.disconnect(&fn);
    }
    
  2. MarcoFalke assigned MarcoFalke on Mar 29, 2019
  3. MarcoFalke commented at 6:46 PM on March 29, 2019: member

    Good catch!

  4. MarcoFalke added the label RPC/REST/ZMQ on Mar 29, 2019
  5. MarcoFalke closed this on Apr 23, 2019

  6. MarcoFalke referenced this in commit 4bd7187da8 on Apr 23, 2019
  7. sidhujag referenced this in commit 648b340f5c on Apr 24, 2019
  8. Munkybooty referenced this in commit 07eee8e934 on Oct 2, 2021
  9. Munkybooty referenced this in commit 223cc0db3b on Oct 7, 2021
  10. Munkybooty referenced this in commit 419053c029 on Oct 7, 2021
  11. Munkybooty referenced this in commit a1342d54be on Oct 12, 2021
  12. Munkybooty referenced this in commit e0cad4bdfb on Oct 16, 2021
  13. Munkybooty referenced this in commit 315b30eb55 on Oct 20, 2021
  14. Munkybooty referenced this in commit 5fa430b9db on Oct 21, 2021
  15. Munkybooty referenced this in commit adc1e8ed7b on Oct 23, 2021
  16. PastaPastaPasta referenced this in commit 5a03c3f612 on Oct 24, 2021
  17. PastaPastaPasta referenced this in commit 90c82aca85 on Oct 25, 2021
  18. pravblockc referenced this in commit c5d2cbbe72 on Nov 18, 2021
  19. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me