Skip to content

Commit bc00e13

Browse files
committed
qt: Handle exceptions in WalletModel::pollBalanceChanged slot
Actually, the private QTimer::timeout signal has one QTimer::QPrivateSignal parameter.
1 parent eb6156b commit bc00e13

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/qt/walletmodel.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ WalletModel::~WalletModel()
6565
void WalletModel::startPollBalance()
6666
{
6767
// This timer will be fired repeatedly to update the balance
68-
connect(timer, &QTimer::timeout, this, &WalletModel::pollBalanceChanged);
68+
// Since the QTimer::timeout is a private signal, it cannot be used
69+
// in the GUIUtil::ExceptionSafeConnect directly.
70+
connect(timer, &QTimer::timeout, this, &WalletModel::timerTimeout);
71+
GUIUtil::ExceptionSafeConnect(this, &WalletModel::timerTimeout, this, &WalletModel::pollBalanceChanged);
6972
timer->start(MODEL_UPDATE_DELAY);
7073
}
7174

src/qt/walletmodel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ class WalletModel : public QObject
223223
// Notify that there are now keys in the keypool
224224
void canGetAddressesChanged();
225225

226+
void timerTimeout();
227+
226228
public Q_SLOTS:
227229
/* Starts a timer to periodically update the balance */
228230
void startPollBalance();

0 commit comments

Comments
 (0)