@@ -78,14 +78,6 @@ std::map<std::string, bool> WalletController::listWalletDir() const
7878 return wallets;
7979}
8080
81- void WalletController::removeWallet (WalletModel* wallet_model)
82- {
83- // Once the wallet is successfully removed from the node, the model will emit the 'WalletModel::unload' signal.
84- // This signal is already connected and will complete the removal of the view from the GUI.
85- // Look at 'WalletController::getOrCreateWallet' for the signal connection.
86- wallet_model->wallet ().remove ();
87- }
88-
8981void WalletController::closeWallet (WalletModel* wallet_model, QWidget* parent)
9082{
9183 QMessageBox box (parent);
@@ -96,7 +88,10 @@ void WalletController::closeWallet(WalletModel* wallet_model, QWidget* parent)
9688 box.setDefaultButton (QMessageBox::Yes);
9789 if (box.exec () != QMessageBox::Yes) return ;
9890
99- removeWallet (wallet_model);
91+ // First remove wallet from node.
92+ wallet_model->wallet ().remove ();
93+ // Now release the model.
94+ removeAndDeleteWallet (wallet_model);
10095}
10196
10297void WalletController::closeAllWallets (QWidget* parent)
@@ -109,8 +104,11 @@ void WalletController::closeAllWallets(QWidget* parent)
109104
110105 QMutexLocker locker (&m_mutex);
111106 for (WalletModel* wallet_model : m_wallets) {
112- removeWallet (wallet_model);
107+ wallet_model->wallet ().remove ();
108+ Q_EMIT walletRemoved (wallet_model);
109+ delete wallet_model;
113110 }
111+ m_wallets.clear ();
114112}
115113
116114WalletModel* WalletController::getOrCreateWallet (std::unique_ptr<interfaces::Wallet> wallet)
0 commit comments