diff options
| author | João Barbosa <[email protected]> | 2019-10-12 22:26:47 +0100 |
|---|---|---|
| committer | João Barbosa <[email protected]> | 2019-10-14 10:53:33 +0100 |
| commit | a8f5026d6d992fd8d72908c848c5028f0f9a8cd1 (patch) | |
| tree | c14f5fdd114c4782091cb487f238032eac403e75 /src/qt/walletcontroller.cpp | |
| parent | Merge #16947: doc: Doxygen-friendly script/descriptor.h comments (diff) | |
| download | discoin-a8f5026d6d992fd8d72908c848c5028f0f9a8cd1.tar.xz discoin-a8f5026d6d992fd8d72908c848c5028f0f9a8cd1.zip | |
gui: Fix start timer from non QThread
Diffstat (limited to 'src/qt/walletcontroller.cpp')
| -rw-r--r-- | src/qt/walletcontroller.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp index fa6f9f3f1..a8de5392b 100644 --- a/src/qt/walletcontroller.cpp +++ b/src/qt/walletcontroller.cpp @@ -108,6 +108,12 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal wallet_model->setParent(this); m_wallets.push_back(wallet_model); + // WalletModel::startPollBalance needs to be called in a thread managed by + // Qt because of startTimer. Considering the current thread can be a RPC + // thread, better delegate the calling to Qt with Qt::AutoConnection. + const bool called = QMetaObject::invokeMethod(wallet_model, "startPollBalance"); + assert(called); + connect(wallet_model, &WalletModel::unload, [this, wallet_model] { // Defer removeAndDeleteWallet when no modal widget is active. // TODO: remove this workaround by removing usage of QDiallog::exec. |