aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/qt/walletcontroller.cpp6
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