Fix handling of load wallet in controller#447
Conversation
Previous implementation was loading the wallet twice
What scenarios are you referring to? |
This is the QList member of the walletqmlcontroller. Previously it wasn't properly checking if we had the wallet in the list already before calling loadWallet and storing the unique_ptr in this list. You'll see the check at the top of setSelectedWallet now. The other change is that we don't use the unique_ptr after loadWallet, instead the handleLoadWallet method is used to store the resulting wallet. handleLoadWallet gets called anytime a wallet is loaded either from calling that interface method, rpc load, or at startup. |
johnny9
left a comment
There was a problem hiding this comment.
Tested on Ubuntu desktop.
- With multiple wallets created and all of them unloaded, selected each wallet to test that it doesn't crash.
- With the wallets previously loaded, start the application and select each wallet in the select to test that it doesn't crash
- Started the application with a datadir that contains no wallets to validate initialization handles the empty case properly
…ller c3c63a9 qml: Fix handling of load wallet in controller (johnny9) Pull request description: Don't load wallet if we already have them loaded. There are 3 changes to the original code. In setSelectedWallet there is a proper check to see if there's already an instance of the wallet loaded in our m_wallets list and sets selected_wallet to that if true, It only loads the wallet into the list once (handleLoadWallet gets called when doing loadWallet), and it fixes the initialize to not call handlLoadWallet and emit selectedWalletChanged a bunch of times. ACKs for top commit: jarolrod: ACK c3c63a9 Tree-SHA512: daba6fb019ba78f1c83105e34a1d724408ba83a4564942dd127d1e0edd0fc5abc63e3080b9b621cce9ae27b2dca96070300caaa8250c4c031836f34b5b678a07
…ller
c3c63a98cf42cc22e3423cacb66dd56b9caeea5e qml: Fix handling of load wallet in controller (johnny9)
Pull request description:
Don't load wallet if we already have them loaded.
There are 3 changes to the original code. In setSelectedWallet there is a proper check to see if there's already an instance of the wallet loaded in our m_wallets list and sets selected_wallet to that if true, It only loads the wallet into the list once (handleLoadWallet gets called when doing loadWallet), and it fixes the initialize to not call handlLoadWallet and emit selectedWalletChanged a bunch of times.
ACKs for top commit:
jarolrod:
ACK c3c63a98cf42cc22e3423cacb66dd56b9caeea5e
Tree-SHA512: daba6fb019ba78f1c83105e34a1d724408ba83a4564942dd127d1e0edd0fc5abc63e3080b9b621cce9ae27b2dca96070300caaa8250c4c031836f34b5b678a07
Don't load wallet if we already have them loaded.
There are 3 changes to the original code. In setSelectedWallet there is a proper check to see if there's already an instance of the wallet loaded in our m_wallets list and sets selected_wallet to that if true, It only loads the wallet into the list once (handleLoadWallet gets called when doing loadWallet), and it fixes the initialize to not call handlLoadWallet and emit selectedWalletChanged a bunch of times.