mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-07-05 19:50:40 +02:00
b83a999b14btcsignals: delete broken scoped_connection move assignment (Thomas) Pull request description: The defaulted move-assignment operator for `scoped_connection` overwrites `m_conn` without first calling `disconnect()`. Since disconnection is signaled via the liveness flag (which is never cleared) the old callback remains registered in the signal and keeps firing, violating the RAII contract: ```cpp int val{0}; btcsignals::scoped_connection sc0 = sig.connect(IncrementCallback); btcsignals::scoped_connection sc1 = sig.connect(SquareCallback); sc0 = std::move(sc1); val = 3; sig(val); // Expected: 9 (only SquareCallback) // Actual: 16 (both callbacks fire, old connection leaked) ``` Move assignment is unused in the codebase, so following the review discussion this deletes the broken operator instead of fixing it. A correct implementation can be added if a use case arises. Earlier versions of this PR fixed the operator and added a default constructor to enable the member-variable assignment pattern; that was dropped in favor of removing the unused operation. ACKs for top commit: maflcko: lgtm ACKb83a999b14sedited: ACKb83a999b14Tree-SHA512: 794347e9cb868d50957ea298f7df6eac5b9f55b9d35ab09e41be269923c45e0709194431dea66b7977c74f802150ba53cb2d12d35937f4966ec302bffb9c95f8