Therefore, manual disconnections are redundant in class destructors.
Skip manual signal disconnection in `~WalletModel()` dtor
A boost::signals2::scoped_connection automatically disconnects on
its destruction.
https://www.boost.org/doc/libs/1_64_0/doc/html/boost/signals2/scoped_connection.html
596f43e786
Skip manual signal disconnection in `~TransactionTableModel()` dtor
A boost::signals2::scoped_connection automatically disconnects on
its destruction.
https://www.boost.org/doc/libs/1_64_0/doc/html/boost/signals2/scoped_connection.html
6471fb5a73
Skip manual signal disconnection in `~BitcoinGUI()` dtor
A boost::signals2::scoped_connection automatically disconnects on
its destruction.
https://www.boost.org/doc/libs/1_64_0/doc/html/boost/signals2/scoped_connection.html
611ced8714
Skip manual signal disconnection in `~ClientModel()` dtor
A boost::signals2::scoped_connection automatically disconnects on
its destruction.
https://www.boost.org/doc/libs/1_64_0/doc/html/boost/signals2/scoped_connection.html
512072f9c9
hebasto added the label
Refactoring
on May 26, 2022
promag
commented at 12:50 pm on May 26, 2022:
contributor
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
furszy approved
furszy
commented at 5:28 pm on May 27, 2022:
contributor
Code review ACK512072f9
To not forget about this, would be nice to add a doc comment at the top of the HandlerImpl class and MakeHandler(boost::signals2::connection) explaining that the returned Handler disconnects the signal when the object is destructed.
jarolrod
commented at 11:03 pm on May 28, 2022:
member
ACK512072f9c969b414a71cec56e348ef6136a31385
Confirmed PR description, and compiled and ran locally.
hebasto
commented at 2:40 pm on May 29, 2022:
member
ryanofsky
commented at 7:07 pm on May 31, 2022:
contributor
Tentative code review ACK512072f9c969b414a71cec56e348ef6136a31385. For all the commits except the first commit, the destructors are non-empty, so this PR changes behavior by disconnecting signals after the other code in the destructor instead of before the other code in the constructor. In theory this could be a problem if a new signal is sent while the object is being destroyed. Previously the signal would be ignored, now it could call methods on a half destroyed object.
It would be good if commit messages acknowledged the delayed disconnection of signals, and perhaps explained why it was safe to delay disconnecting signals.
hebasto
commented at 7:50 pm on May 31, 2022:
member
… now it could call methods on a half destroyed object.
During destruction, only one thread has access to the object, right?
ryanofsky
commented at 8:23 pm on May 31, 2022:
contributor
… now it could call methods on a half destroyed object.
During destruction, only one thread has access to the object, right?
The lambdas passed to handleNotification methods are capturing [this] so they can reference the object when notifications are sent. That is why it might be important to disconnect the notifications earlier instead of later. But I don’t know whether this is important, which is why I raised the question. Also even if notifications were single threaded (I don’t think they are) it might still matter if they are disconnected later during destruction instead of earlier, because maybe later code in the destructor could trigger them.
Overall, I would guess this PR is probably safe, I just think it could use a better explanation of how it is safe.
hebasto
commented at 1:29 pm on July 19, 2022:
member
Thank all of reviewers for your reviews.
Going to close this PR to do not raise safety concerns.
This is a metadata mirror of the GitHub repository
bitcoin-core/gui.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2024-11-21 12:20 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me