Skip to content

Commit c09fd3a

Browse files
committed
qt: Ditch wallet model juggling
1 parent 2c87f99 commit c09fd3a

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

src/qt/walletcontroller.cpp

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,19 +128,10 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
128128
}
129129
}
130130

131-
// Instantiate model and register it.
132-
WalletModel* wallet_model = new WalletModel(std::move(wallet), m_client_model, m_platform_style,
133-
nullptr /* required for the following moveToThread() call */);
134-
135-
// Move WalletModel object to the thread that created the WalletController
136-
// object (GUI main thread), instead of the current thread, which could be
137-
// an outside wallet thread or RPC thread sending a LoadWallet notification.
138-
// This ensures queued signals sent to the WalletModel object will be
139-
// handled on the GUI event loop.
140-
wallet_model->moveToThread(thread());
141-
// setParent(parent) must be called in the thread which created the parent object. More details in #18948.
142-
GUIUtil::ObjectInvoke(this, [wallet_model, this] {
143-
wallet_model->setParent(this);
131+
WalletModel* wallet_model;
132+
// Instantiate model in GUI main thread.
133+
GUIUtil::ObjectInvoke(this, [&] {
134+
wallet_model = new WalletModel(std::move(wallet), m_client_model, m_platform_style, this);
144135
}, GUIUtil::blockingGUIThreadConnection());
145136

146137
m_wallets.push_back(wallet_model);

0 commit comments

Comments
 (0)