mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-20 23:20:45 +02:00
qt: Call setParent() in the parent's context
setParent(parent) calls sendEvent(parent, QChildEvent) that implies running in the thread which created the parent object.
This commit is contained in:
parent
5659e73493
commit
5fcfee68af
@ -131,7 +131,11 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
|
|||||||
WalletModel* wallet_model = new WalletModel(std::move(wallet), m_client_model, m_platform_style, nullptr);
|
WalletModel* wallet_model = new WalletModel(std::move(wallet), m_client_model, m_platform_style, nullptr);
|
||||||
// Handler callback runs in a different thread so fix wallet model thread affinity.
|
// Handler callback runs in a different thread so fix wallet model thread affinity.
|
||||||
wallet_model->moveToThread(thread());
|
wallet_model->moveToThread(thread());
|
||||||
wallet_model->setParent(this);
|
// setParent(parent) must be called in the thread which created the parent object. More details in #18948.
|
||||||
|
GUIUtil::ObjectInvoke(this, [wallet_model, this] {
|
||||||
|
wallet_model->setParent(this);
|
||||||
|
}, GUIUtil::blockingGUIThreadConnection());
|
||||||
|
|
||||||
m_wallets.push_back(wallet_model);
|
m_wallets.push_back(wallet_model);
|
||||||
|
|
||||||
// WalletModel::startPollBalance needs to be called in a thread managed by
|
// WalletModel::startPollBalance needs to be called in a thread managed by
|
||||||
|
Loading…
Reference in New Issue
Block a user