mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 15:39:05 +01:00
gui: Fix start timer from non QThread
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user