From 42b5d182ee639933a8dd639f12f5c99e66f55a63 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 17 Feb 2022 11:27:17 -0500 Subject: [PATCH] Create new rpc connection during shutdown if we don't have one and debug logging --- src/controller.cpp | 9 +++++++-- src/mainwindow.cpp | 12 ++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/controller.cpp b/src/controller.cpp index 63773a4..81badcb 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -1987,6 +1987,11 @@ void Controller::refreshHUSHPrice() void Controller::shutdownhushd() { // Save the wallet and exit the lightclient library cleanly. + if (!zrpc) { + zrpc = new LiteInterface(); + qDebug() << __func__ << ": created new rpc connection zrpc=" << zrpc; + } + if (zrpc && zrpc->haveConnection()) { QDialog d(main); @@ -2018,13 +2023,13 @@ void Controller::shutdownhushd() if (!finished) d.accept(); finished = true; - qDebug() << "saveWallet during shutdownhushd"; + qDebug() << __func__ << ": saveWallet finished"; }); if (!finished) d.exec(); } else { - qDebug() << "No zrpc object, unclean shutdown and unable to call saveWallet!"; + qDebug() << __func__ << ": No zrpc object, unclean shutdown and unable to call saveWallet!"; } } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ade4ca2..14f6b20 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -434,8 +434,12 @@ void MainWindow::closeEvent(QCloseEvent* event) { void MainWindow::closeEventpw(QCloseEvent* event) { // Let the RPC know to shut down any running service. - qDebug() << __func__ << ": event=" << event; - rpc->shutdownhushd(); + qDebug() << __func__ << ": event=" << event << " this=" << this; + if (rpc) { + rpc->shutdownhushd(); + } else { + qDebug() << __func__ << ": invalid rpc object!"; + } } void MainWindow::encryptWallet() { @@ -444,6 +448,8 @@ void MainWindow::encryptWallet() { Ui_encryptionDialog ed; ed.setupUi(&d); + qDebug() << __func__ << ": start"; + // Handle edits on the password box auto fnPasswordEdited = [=](const QString&) { @@ -500,6 +506,7 @@ void MainWindow::encryptWallet() { QString("Please close some other programs to free up memory and try again"), QMessageBox::Ok ); + qDebug() << __func__ << ": out of memory!"; exit(1); } QString passphraseHash1 = QByteArray(reinterpret_cast(key), KEY_LEN).toHex(); @@ -520,6 +527,7 @@ void MainWindow::encryptWallet() { QMessageBox::Ok ); } + qDebug() << __func__ << ": finish"; } void MainWindow::removeWalletEncryption() {