commit 1da1f0bfea4c6fa86ced750780baae3f325c6ce9
parent 8f4967f7d0715a9f279ef4b3f0f8bf96ee6844bd
Author: ThomasV <thomasv@electrum.org>
Date: Fri, 8 Feb 2019 11:17:48 +0100
fix #4984
Diffstat:
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/electrum/daemon.py b/electrum/daemon.py
@@ -262,6 +262,13 @@ class Daemon(DaemonThread):
def get_wallet(self, path):
return self.wallets.get(path)
+ def delete_wallet(self, path):
+ self.stop_wallet(path)
+ if os.path.exists(path):
+ os.unlink(path)
+ return True
+ return False
+
def stop_wallet(self, path):
wallet = self.wallets.pop(path, None)
if not wallet: return
diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
@@ -2197,10 +2197,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
def _delete_wallet(self, password):
wallet_path = self.wallet.storage.path
basename = os.path.basename(wallet_path)
- self.gui_object.daemon.stop_wallet(wallet_path)
+ r = self.gui_object.daemon.delete_wallet(wallet_path)
self.close()
- os.unlink(wallet_path)
- self.show_error(_("Wallet removed: {}").format(basename))
+ if r:
+ self.show_error(_("Wallet removed: {}").format(basename))
+ else:
+ self.show_error(_("Wallet file not found: {}").format(basename))
@protected
def show_seed_dialog(self, password):