Skip to content

Commit

Permalink
main: don't attempt to close already closed wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
xiphon committed Aug 6, 2019
1 parent 0461a28 commit f666e6f
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions main.qml
Expand Up @@ -239,7 +239,6 @@ ApplicationWindow {
if (typeof currentWallet !== "undefined" && currentWallet !== null) { if (typeof currentWallet !== "undefined" && currentWallet !== null) {
console.log("Daemon change - closing " + currentWallet) console.log("Daemon change - closing " + currentWallet)
closeWallet(); closeWallet();
currentWallet = undefined
} else if (!walletInitialized) { } else if (!walletInitialized) {
// set page to transfer if not changing daemon // set page to transfer if not changing daemon
middlePanel.state = "Transfer"; middlePanel.state = "Transfer";
Expand Down Expand Up @@ -286,25 +285,30 @@ ApplicationWindow {
function closeWallet(callback) { function closeWallet(callback) {


// Disconnect all listeners // Disconnect all listeners
if (typeof currentWallet !== "undefined" && currentWallet !== null) { if (typeof currentWallet === "undefined" || currentWallet === null) {
currentWallet.heightRefreshed.disconnect(onHeightRefreshed); if (callback) {
currentWallet.refreshed.disconnect(onWalletRefresh) callback();
currentWallet.updated.disconnect(onWalletUpdate) }
currentWallet.newBlock.disconnect(onWalletNewBlock) return;
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.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; currentWallet = undefined;


appWindow.showProcessingSplash(qsTr("Closing wallet...")); appWindow.showProcessingSplash(qsTr("Closing wallet..."));
Expand Down Expand Up @@ -1122,7 +1126,6 @@ ApplicationWindow {
clearMoneroCardLabelText(); clearMoneroCardLabelText();
walletInitialized = false; walletInitialized = false;
closeWallet(function() { closeWallet(function() {
currentWallet = undefined;
wizard.restart(); wizard.restart();
wizard.wizardState = "wizardHome"; wizard.wizardState = "wizardHome";
rootItem.state = "wizard" rootItem.state = "wizard"
Expand Down

0 comments on commit f666e6f

Please sign in to comment.