aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxiphon <xiphon@protonmail.com>2019-08-06 10:50:26 +0000
committerxiphon <xiphon@protonmail.com>2019-08-06 10:50:26 +0000
commitf666e6f42eb631846e992183d6df5e67f57a4f70 (patch)
tree16339df0a2094984f0083bd3daa7c96c4ba00f2a
parent0461a2870106928cc40db2d6f39514898c68a292 (diff)
downloadmonzero-gui-f666e6f42eb631846e992183d6df5e67f57a4f70.tar.gz
monzero-gui-f666e6f42eb631846e992183d6df5e67f57a4f70.tar.xz
monzero-gui-f666e6f42eb631846e992183d6df5e67f57a4f70.zip
main: don't attempt to close already closed wallet
-rw-r--r--main.qml41
1 files changed, 22 insertions, 19 deletions
diff --git a/main.qml b/main.qml
index 48fde1a9..76057fda 100644
--- a/main.qml
+++ b/main.qml
@@ -239,7 +239,6 @@ ApplicationWindow {
if (typeof currentWallet !== "undefined" && currentWallet !== null) {
console.log("Daemon change - closing " + currentWallet)
closeWallet();
- currentWallet = undefined
} else if (!walletInitialized) {
// set page to transfer if not changing daemon
middlePanel.state = "Transfer";
@@ -286,25 +285,30 @@ ApplicationWindow {
function closeWallet(callback) {
// Disconnect all listeners
- if (typeof currentWallet !== "undefined" && currentWallet !== null) {
- currentWallet.heightRefreshed.disconnect(onHeightRefreshed);
- currentWallet.refreshed.disconnect(onWalletRefresh)
- currentWallet.updated.disconnect(onWalletUpdate)
- currentWallet.newBlock.disconnect(onWalletNewBlock)
- currentWallet.moneySpent.disconnect(onWalletMoneySent)
- currentWallet.moneyReceived.disconnect(onWalletMoneyReceived)
- currentWallet.unconfirmedMoneyReceived.disconnect(onWalletUnconfirmedMoneyReceived)
- currentWallet.transactionCreated.disconnect(onTransactionCreated)
- currentWallet.connectionStatusChanged.disconnect(onWalletConnectionStatusChanged)
- currentWallet.deviceButtonRequest.disconnect(onDeviceButtonRequest);
- currentWallet.deviceButtonPressed.disconnect(onDeviceButtonPressed);
- currentWallet.transactionCommitted.disconnect(onTransactionCommitted);
- middlePanel.paymentClicked.disconnect(handlePayment);
- middlePanel.sweepUnmixableClicked.disconnect(handleSweepUnmixable);
- middlePanel.getProofClicked.disconnect(handleGetProof);
- middlePanel.checkProofClicked.disconnect(handleCheckProof);
+ if (typeof currentWallet === "undefined" || currentWallet === null) {
+ if (callback) {
+ callback();
+ }
+ return;
}
+ currentWallet.heightRefreshed.disconnect(onHeightRefreshed);
+ currentWallet.refreshed.disconnect(onWalletRefresh)
+ currentWallet.updated.disconnect(onWalletUpdate)
+ currentWallet.newBlock.disconnect(onWalletNewBlock)
+ currentWallet.moneySpent.disconnect(onWalletMoneySent)
+ currentWallet.moneyReceived.disconnect(onWalletMoneyReceived)
+ currentWallet.unconfirmedMoneyReceived.disconnect(onWalletUnconfirmedMoneyReceived)
+ currentWallet.transactionCreated.disconnect(onTransactionCreated)
+ currentWallet.connectionStatusChanged.disconnect(onWalletConnectionStatusChanged)
+ currentWallet.deviceButtonRequest.disconnect(onDeviceButtonRequest);
+ currentWallet.deviceButtonPressed.disconnect(onDeviceButtonPressed);
+ currentWallet.transactionCommitted.disconnect(onTransactionCommitted);
+ middlePanel.paymentClicked.disconnect(handlePayment);
+ middlePanel.sweepUnmixableClicked.disconnect(handleSweepUnmixable);
+ middlePanel.getProofClicked.disconnect(handleGetProof);
+ middlePanel.checkProofClicked.disconnect(handleCheckProof);
+
currentWallet = undefined;
appWindow.showProcessingSplash(qsTr("Closing wallet..."));
@@ -1122,7 +1126,6 @@ ApplicationWindow {
clearMoneroCardLabelText();
walletInitialized = false;
closeWallet(function() {
- currentWallet = undefined;
wizard.restart();
wizard.wizardState = "wizardHome";
rootItem.state = "wizard"