diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-08-14 20:53:35 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-11-25 16:12:32 +0200 |
commit | 5fcfee68af47d4a891ae9c9964d73886f0f01d7d (patch) | |
tree | 12620c8013a41c129308a0d2e466be591249a47b /src/qt/walletcontroller.cpp | |
parent | 5659e73493fcdfb5d0cb9d686c24c4fbe1c217ed (diff) |
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.
Diffstat (limited to 'src/qt/walletcontroller.cpp')
-rw-r--r-- | src/qt/walletcontroller.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp index d9e0274d01..a59f33b785 100644 --- a/src/qt/walletcontroller.cpp +++ b/src/qt/walletcontroller.cpp @@ -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); // Handler callback runs in a different thread so fix wallet model thread affinity. 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); // WalletModel::startPollBalance needs to be called in a thread managed by |