aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.qml27
-rw-r--r--src/libwalletqt/Wallet.cpp6
2 files changed, 18 insertions, 15 deletions
diff --git a/main.qml b/main.qml
index 467a4951..a9d22d5a 100644
--- a/main.qml
+++ b/main.qml
@@ -135,7 +135,7 @@ ApplicationWindow {
// If currentWallet exists, we're just switching daemon - close/reopen wallet
if (typeof currentWallet !== "undefined" && currentWallet !== null) {
console.log("Daemon change - closing " + currentWallet)
- walletManager.closeWalletAsync();
+ closeWallet();
currentWallet = undefined
} else {
@@ -170,13 +170,9 @@ ApplicationWindow {
}
}
+ function closeWallet() {
-
- function connectWallet(wallet) {
- showProcessingSplash("Please wait...")
- currentWallet = wallet
-
- // Disconnect before connecting
+ // Disconnect all listeners
currentWallet.refreshed.disconnect(onWalletRefresh)
currentWallet.updated.disconnect(onWalletUpdate)
currentWallet.newBlock.disconnect(onWalletNewBlock)
@@ -188,6 +184,14 @@ ApplicationWindow {
middlePanel.sweepUnmixableClicked.disconnect(handleSweepUnmixable);
middlePanel.checkPaymentClicked.disconnect(handleCheckPayment);
+ walletManager.closeWalletAsync();
+ currentWallet = undefined;
+ }
+
+ function connectWallet(wallet) {
+ showProcessingSplash("Please wait...")
+ currentWallet = wallet
+
// connect handlers
currentWallet.refreshed.connect(onWalletRefresh)
currentWallet.updated.connect(onWalletUpdate)
@@ -222,7 +226,7 @@ ApplicationWindow {
if (appWindow.password === '') {
console.error("Error opening wallet with empty password: ", wallet.errorString);
console.log("closing wallet async : " + wallet.address)
- walletManager.closeWalletAsync()
+ closeWallet();
currentWallet = undefined
// try to open wallet with password;
@@ -235,7 +239,7 @@ ApplicationWindow {
informationPopup.text = qsTr("Couldn't open wallet: ") + wallet.errorString;
informationPopup.icon = StandardIcon.Critical
console.log("closing wallet async : " + wallet.address)
- walletManager.closeWalletAsync();
+ closeWallet();
currentWallet = undefined
informationPopup.open()
informationPopup.onCloseCallback = function() {
@@ -611,8 +615,7 @@ ApplicationWindow {
function showWizard(){
walletInitialized = false;
splashCounter = 0;
- walletManager.closeWalletAsync();
- currentWallet = undefined
+ closeWallet();
wizard.restart();
rootItem.state = "wizard"
}
@@ -1033,7 +1036,7 @@ ApplicationWindow {
}
onClosing: {
- // Close wallet
+ // Close wallet non async on exit
walletManager.closeWallet();
// Stop daemon
daemonManager.stop();
diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp
index 61a2920c..5bf75788 100644
--- a/src/libwalletqt/Wallet.cpp
+++ b/src/libwalletqt/Wallet.cpp
@@ -480,7 +480,7 @@ Wallet::~Wallet()
qDebug("~Wallet: Closing wallet");
delete m_history;
-
- Monero::WalletManagerFactory::getWalletManager()->closeWallet(m_walletImpl);
-
+ //Monero::WalletManagerFactory::getWalletManager()->closeWallet(m_walletImpl);
+ delete m_walletImpl;
+ qDebug("m_walletImpl deleted");
}