diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-08-12 20:00:42 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-08-12 20:03:00 +0300 |
commit | 439e58c4d8194ca37f70346727d31f52e69592ec (patch) | |
tree | cadb9f82bfa3c83dc873b16f1c665029a7e6e36a | |
parent | 9948f114f8e6fa7c998c4ede84719f5d1699e5e7 (diff) | |
parent | 93cc53a2b27eeb05fe00b8bf17465037815473a1 (diff) | |
download | bitcoin-439e58c4d8194ca37f70346727d31f52e69592ec.tar.xz |
Merge bitcoin-core/gui#360: Unregister wallet notifications before unloading wallets
93cc53a2b27eeb05fe00b8bf17465037815473a1 gui: Unregister wallet notifications before unloading wallets (Russell Yanofsky)
Pull request description:
This change was originally part of both bitcoin/bitcoin#10102 and bitcoin/bitcoin#19101 and is required for both because it avoids the IPC wallet implementation in bitcoin/bitcoin#10102 and the WalletContext implementation in bitcoin/bitcoin#19101 needing to deal with notification objects that have stale pointers to deleted wallets.
ACKs for top commit:
promag:
Code review ACK 93cc53a2b27eeb05fe00b8bf17465037815473a1.
hebasto:
ACK 93cc53a2b27eeb05fe00b8bf17465037815473a1
Tree-SHA512: 805f50a493291ad0f7c48725fbc5058d58ebbdb0770befd51d8aa241209a13f8a46f5982481336ab8338cdc83e9017668089a71deccf1587308e841cf8697825
-rw-r--r-- | src/qt/bitcoin.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 09f453363d..f6ea147ddb 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -343,6 +343,17 @@ void BitcoinApplication::requestShutdown() window->setClientModel(nullptr); pollShutdownTimer->stop(); +#ifdef ENABLE_WALLET + // Delete wallet controller here manually, instead of relying on Qt object + // tracking (https://doc.qt.io/qt-5/objecttrees.html). This makes sure + // walletmodel m_handle_* notification handlers are deleted before wallets + // are unloaded, which can simplify wallet implementations. It also avoids + // these notifications having to be handled while GUI objects are being + // destroyed, making GUI code less fragile as well. + delete m_wallet_controller; + m_wallet_controller = nullptr; +#endif // ENABLE_WALLET + delete clientModel; clientModel = nullptr; |