From 37aa04e3e5b642ee7fb2d1a9f024a19a8de47019 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Tue, 1 Oct 2024 05:45:21 +0200 Subject: [PATCH] firehose application shutdown --- src/Application.cpp | 1 + src/MainWindow.cpp | 3 ++- src/WindowManager.cpp | 8 +++++--- src/libwalletqt/Wallet.cpp | 4 ++-- src/libwalletqt/WalletManager.cpp | 1 + src/utils/scheduler.cpp | 1 + 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Application.cpp b/src/Application.cpp index 5758662..d4de15f 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -79,6 +79,7 @@ Application::Application(int& argc, char** argv) Application::~Application() { + qDebug() << "~Application"; if (m_lockFile) { m_lockFile->unlock(); delete m_lockFile; diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 1bcd07b..fa2b4c2 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1207,6 +1207,7 @@ void MainWindow::closeEvent(QCloseEvent *event) { qDebug() << Q_FUNC_INFO; if (!this->cleanedUp) { + qDebug() << "MainWindow: cleaning up"; this->cleanedUp = true; emit aboutToQuit(); @@ -1934,5 +1935,5 @@ int MainWindow::findTab(const QString &title) { } MainWindow::~MainWindow() { - qDebug() << "~MainWindow"; + qDebug() << "~MainWindow" << QThread::currentThreadId(); } \ No newline at end of file diff --git a/src/WindowManager.cpp b/src/WindowManager.cpp index 2dd5370..d892fec 100644 --- a/src/WindowManager.cpp +++ b/src/WindowManager.cpp @@ -67,7 +67,7 @@ WindowManager::~WindowManager() { qDebug() << "~WindowManager"; m_cleanupThread->quit(); m_cleanupThread->wait(); - qDebug() << "Cleanup thread done"; + qDebug() << "WindowManager: cleanup thread done" << QThread::currentThreadId(); } // ######################## APPLICATION LIFECYCLE ######################## @@ -82,7 +82,7 @@ void WindowManager::quitAfterLastWindow() { } void WindowManager::close() { - qDebug() << Q_FUNC_INFO; + qDebug() << Q_FUNC_INFO << QThread::currentThreadId(); for (const auto &window: m_windows) { window->close(); } @@ -102,12 +102,14 @@ void WindowManager::close() { torManager()->stop(); + deleteLater(); + qDebug() << "Calling QApplication::quit()"; QApplication::quit(); } void WindowManager::closeWindow(MainWindow *window) { - qDebug() << "closing Window"; + qDebug() << "WindowManager: closing Window"; m_windows.removeOne(window); // Move Wallet to a different thread for cleanup, so it doesn't block GUI thread diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index 61fb184..b806bd5 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -1431,7 +1431,7 @@ void Wallet::getTxPoolStatsAsync() { Wallet::~Wallet() { - qDebug("~Wallet: Closing wallet"); + qDebug() << "~Wallet: Closing wallet" << QThread::currentThreadId(); pauseRefresh(); m_walletImpl->stop(); @@ -1448,5 +1448,5 @@ Wallet::~Wallet() delete m_walletImpl; m_walletImpl = nullptr; - qDebug("m_walletImpl deleted"); + qDebug() << "m_walletImpl deleted" << QThread::currentThreadId(); } diff --git a/src/libwalletqt/WalletManager.cpp b/src/libwalletqt/WalletManager.cpp index c34fea4..32a4783 100644 --- a/src/libwalletqt/WalletManager.cpp +++ b/src/libwalletqt/WalletManager.cpp @@ -312,6 +312,7 @@ WalletManager::WalletManager(QObject *parent) WalletManager::~WalletManager() { + qDebug() << "~WalletManager" << QThread::currentThreadId(); m_scheduler.shutdownWaitForFinished(); } diff --git a/src/utils/scheduler.cpp b/src/utils/scheduler.cpp index 4610165..94b40f7 100644 --- a/src/utils/scheduler.cpp +++ b/src/utils/scheduler.cpp @@ -10,6 +10,7 @@ FutureScheduler::FutureScheduler(QObject *parent) FutureScheduler::~FutureScheduler() { + qDebug() << "~FutureScheduler:" << QThread::currentThreadId(); shutdownWaitForFinished(); }