aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/init.cpp')
-rw-r--r--src/wallet/init.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp
index b9f267210e..7dc6c30645 100644
--- a/src/wallet/init.cpp
+++ b/src/wallet/init.cpp
@@ -264,7 +264,11 @@ void WalletInit::Stop() const
void WalletInit::Close() const
{
- for (const std::shared_ptr<CWallet>& pwallet : GetWallets()) {
- RemoveWallet(pwallet);
+ auto wallets = GetWallets();
+ while (!wallets.empty()) {
+ auto wallet = wallets.back();
+ wallets.pop_back();
+ RemoveWallet(wallet);
+ UnloadWallet(std::move(wallet));
}
}