Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge bitcoin-core/gui#835: Fix crash when closing wallet
a965f2b gui: fix crash when closing wallet (furszy) Pull request description: The crash occurs because `WalletController::removeAndDeleteWallet` is called twice for the same wallet model: first in the GUI's button connected function `WalletController::closeWallet`, and then again when the backend emits the `WalletModel::unload` signal. This causes the issue because `removeAndDeleteWallet` inlines an `erase(std::remove())`. So, if `std::remove` returns an iterator to the end (indicating the element wasn't found because it was already erased), the subsequent call to `erase` leads to an undefined behavior. Test Notes: Try closing any wallet using the toolbar button in the GUI. It will crash in master, but not here. Fixes bitcoin#30887. ACKs for top commit: pablomartin4btc: tACK a965f2b jarolrod: ACK a965f2b hebasto: ACK a965f2b. Tree-SHA512: c94681b95cb566f7aabd0d4fb10f797c2cea6ac569abc265e918f08e6abae3335432a0b0879372b54b2c109798ed0a4a249bf162c34add59cbd18d38a2d9660e
- Loading branch information