From a46a12ec1294d17284076af8ac22ef7256010d0b Mon Sep 17 00:00:00 2001 From: gg Date: Wed, 14 Jan 2026 08:20:33 -0500 Subject: [PATCH] sync fixes --- src/MainWindow.cpp | 4 +++- src/libwalletqt/Wallet.cpp | 7 +++++++ src/plugins/tickers/TickersWidget.cpp | 1 + src/widgets/TickerWidget.cpp | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 399053cc..9caf3f5e 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -102,6 +102,7 @@ MainWindow::MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *pa connect(m_windowManager, &WindowManager::proxySettingsChanged, this, &MainWindow::onProxySettingsChangedConnect); connect(m_windowManager, &WindowManager::updateBalance, m_wallet, &Wallet::updateBalance); + connect(m_windowManager, &WindowManager::websocketStatusChanged, m_wallet, &Wallet::updateBalance); connect(m_windowManager, &WindowManager::offlineMode, this, &MainWindow::onOfflineMode); connect(m_windowManager, &WindowManager::manualFeeSelectionEnabled, this, &MainWindow::onManualFeeSelectionEnabled); connect(m_windowManager, &WindowManager::subtractFeeFromAmountEnabled, this, &MainWindow::onSubtractFeeFromAmountEnabled); @@ -753,6 +754,7 @@ void MainWindow::initWalletContext() { // Order is important, first inform UI about a potential disconnect, then reconnect this->onConnectionStatusChanged(status); m_nodes->autoConnect(); + this->updateBalance(); }); connect(m_wallet, &Wallet::heightsRefreshed, this, [this](bool success, quint64 daemonHeight, quint64 targetHeight) { @@ -915,7 +917,7 @@ void MainWindow::onBalanceUpdated(quint64 balance, quint64 spendable) { bool isCacheValid = appData()->prices.lastUpdateTime.isValid(); if (balance > 0 && (balanceFiatAmount == 0.0 || !isCacheValid)) { - if (conf()->get(Config::offlineMode).toBool() || m_wallet->connectionStatus() == Wallet::ConnectionStatus_Disconnected) { + if (conf()->get(Config::offlineMode).toBool() || conf()->get(Config::disableWebsocket).toBool() || m_wallet->connectionStatus() == Wallet::ConnectionStatus_Disconnected) { suffixStr += " (offline)"; } else if (!appData()->prices.markets.contains("XMR")) { suffixStr += " (connecting)"; diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index 485c3e22..5d9905e0 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -427,6 +427,10 @@ void Wallet::initAsync(const QString &daemonAddress, bool trustedDaemon, quint64 success = m_walletImpl->init(daemonAddress.toStdString(), upperTransactionLimit, m_daemonUsername.toStdString(), m_daemonPassword.toStdString(), m_useSSL, false, proxyAddress.toStdString()); } + if (m_scheduler.stopping()) { + return; + } + setTrustedDaemon(trustedDaemon); if (success) { @@ -1627,6 +1631,9 @@ Wallet::~Wallet() pauseRefresh(); m_walletImpl->stop(); + // Stop the wallet2 instance to interrupt any blocking network calls (e.g. init) + if (m_wallet2) + m_wallet2->stop(); m_scheduler.shutdownWaitForFinished(); diff --git a/src/plugins/tickers/TickersWidget.cpp b/src/plugins/tickers/TickersWidget.cpp index e55df61b..b9b3a138 100644 --- a/src/plugins/tickers/TickersWidget.cpp +++ b/src/plugins/tickers/TickersWidget.cpp @@ -23,6 +23,7 @@ TickersWidget::TickersWidget(QWidget *parent, Wallet *wallet) this->setup(); } }); + connect(windowManager(), &WindowManager::websocketStatusChanged, this, &TickersWidget::updateDisplay); this->updateBalance(); } diff --git a/src/widgets/TickerWidget.cpp b/src/widgets/TickerWidget.cpp index f6f525ab..8c727eb7 100644 --- a/src/widgets/TickerWidget.cpp +++ b/src/widgets/TickerWidget.cpp @@ -79,7 +79,7 @@ void BalanceTickerWidget::updateDisplay() { bool isCacheFresh = isCacheValid && appData()->prices.lastUpdateTime.secsTo(QDateTime::currentDateTime()) < 3600; if (balanceFiatAmount == 0.0 || !isCacheValid) { - if (conf()->get(Config::offlineMode).toBool() || m_wallet->connectionStatus() == Wallet::ConnectionStatus_Disconnected) { + if (conf()->get(Config::offlineMode).toBool() || conf()->get(Config::disableWebsocket).toBool() || m_wallet->connectionStatus() == Wallet::ConnectionStatus_Disconnected) { this->setDisplayText("offline"); } else if (!appData()->prices.markets.contains("XMR")) { this->setDisplayText("connecting"); -- 2.52.0