Browse Source

qml: tighten self._loading guard to encompass whole loadWallet fn, not just task thread.

Also make sure QEWallet is never instantiated within the task thread.
master
Sander van Grieken 2 years ago
parent
commit
b361d02467
No known key found for this signature in database
GPG Key ID: 9BCF8209EA402EBA
  1. 18
      electrum/gui/qml/qedaemon.py

18
electrum/gui/qml/qedaemon.py

@ -168,6 +168,10 @@ class QEDaemon(AuthMixin, QObject):
@pyqtSlot(str)
@pyqtSlot(str, str)
def loadWallet(self, path=None, password=None):
if self._loading:
return
self._loading = True
if path is None:
self._path = self.daemon.config.get('wallet_path') # command line -w option
if self._path is None:
@ -175,8 +179,11 @@ class QEDaemon(AuthMixin, QObject):
else:
self._path = path
if self._path is None:
self._loading = False
return
self.loadingChanged.emit()
self._path = standardize_path(self._path)
self._name = os.path.basename(self._path)
@ -189,12 +196,11 @@ class QEDaemon(AuthMixin, QObject):
if not password:
password = self._password
wallet_already_open = self.daemon.get_wallet(self._path) is not None
wallet_already_open = self.daemon.get_wallet(self._path)
if wallet_already_open is not None:
wallet_already_open_password = QEWallet.getInstanceFor(wallet_already_open).password
def load_wallet_task():
self._loading = True
self.loadingChanged.emit()
try:
local_password = password # need this in local scope
wallet = None
@ -214,10 +220,10 @@ class QEDaemon(AuthMixin, QObject):
if wallet is None:
return
if wallet_already_open:
if wallet_already_open is not None:
# wallet already open. daemon.load_wallet doesn't mind, but
# we need the correct current wallet password below
local_password = QEWallet.getInstanceFor(wallet).password
local_password = wallet_already_open_password
if self.daemon.config.WALLET_USE_SINGLE_PASSWORD:
self._use_single_password = self.daemon.update_password_for_directory(old_password=local_password, new_password=local_password)

Loading…
Cancel
Save