aboutsummaryrefslogtreecommitdiff
path: root/src/qt/walletcontroller.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/walletcontroller.cpp')
-rw-r--r--src/qt/walletcontroller.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp
index 512ea8a1dc..dd093e984a 100644
--- a/src/qt/walletcontroller.cpp
+++ b/src/qt/walletcontroller.cpp
@@ -79,6 +79,14 @@ std::map<std::string, std::pair<bool, std::string>> WalletController::listWallet
return wallets;
}
+void WalletController::removeWallet(WalletModel* wallet_model)
+{
+ // Once the wallet is successfully removed from the node, the model will emit the 'WalletModel::unload' signal.
+ // This signal is already connected and will complete the removal of the view from the GUI.
+ // Look at 'WalletController::getOrCreateWallet' for the signal connection.
+ wallet_model->wallet().remove();
+}
+
void WalletController::closeWallet(WalletModel* wallet_model, QWidget* parent)
{
QMessageBox box(parent);
@@ -89,10 +97,7 @@ void WalletController::closeWallet(WalletModel* wallet_model, QWidget* parent)
box.setDefaultButton(QMessageBox::Yes);
if (box.exec() != QMessageBox::Yes) return;
- // First remove wallet from node.
- wallet_model->wallet().remove();
- // Now release the model.
- removeAndDeleteWallet(wallet_model);
+ removeWallet(wallet_model);
}
void WalletController::closeAllWallets(QWidget* parent)
@@ -105,11 +110,8 @@ void WalletController::closeAllWallets(QWidget* parent)
QMutexLocker locker(&m_mutex);
for (WalletModel* wallet_model : m_wallets) {
- wallet_model->wallet().remove();
- Q_EMIT walletRemoved(wallet_model);
- delete wallet_model;
+ removeWallet(wallet_model);
}
- m_wallets.clear();
}
WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wallet> wallet)