Skip to content

Commit 21d56e7

Browse files
committed
[GUI] Topbar: don't try to poll for data if shutdown was requested.
1 parent 2518433 commit 21d56e7

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/qt/pivx/topbar.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,12 +443,13 @@ void TopBar::setStakingStatusActive(bool fActive)
443443
}
444444
void TopBar::updateStakingStatus()
445445
{
446-
setStakingStatusActive(walletModel &&
447-
!walletModel->isWalletLocked() &&
448-
walletModel->isStakingStatusActive());
446+
if (walletModel && !walletModel->isShutdownRequested()) {
447+
setStakingStatusActive(!walletModel->isWalletLocked() &&
448+
walletModel->isStakingStatusActive());
449449

450-
// Taking advantage of this timer to update Tor status if needed.
451-
updateTorIcon();
450+
// Taking advantage of this timer to update Tor status if needed.
451+
updateTorIcon();
452+
}
452453
}
453454

454455
void TopBar::setNumConnections(int count)

src/qt/walletmodel.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "optionsmodel.h"
1212
#include "recentrequeststablemodel.h"
1313
#include "transactiontablemodel.h"
14+
#include "init.h" // for ShutdownRequested(). Future: move to an interface wrapper
1415

1516
#include "base58.h"
1617
#include "coincontrol.h"
@@ -67,6 +68,11 @@ bool WalletModel::isRegTestNetwork() const
6768
return Params().IsRegTestNet();
6869
}
6970

71+
bool WalletModel::isShutdownRequested()
72+
{
73+
return ShutdownRequested();
74+
}
75+
7076
bool WalletModel::isColdStakingNetworkelyEnabled() const
7177
{
7278
return !sporkManager.IsSporkActive(SPORK_19_COLDSTAKING_MAINTENANCE);

src/qt/walletmodel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ class WalletModel : public QObject
151151

152152
bool isTestNetwork() const;
153153
bool isRegTestNetwork() const;
154+
bool isShutdownRequested();
154155
/** Whether cold staking is enabled or disabled in the network **/
155156
bool isColdStakingNetworkelyEnabled() const;
156157
bool isSaplingInMaintenance() const;

0 commit comments

Comments
 (0)