mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 11:13:23 -03:00
qt: Improve comments in WalletController::getOrCreateWallet()
This commit is contained in:
parent
5fcfee68af
commit
8963b2c71f
1 changed files with 8 additions and 3 deletions
|
@ -128,8 +128,14 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instantiate model and register it.
|
// Instantiate model and register it.
|
||||||
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,
|
||||||
// Handler callback runs in a different thread so fix wallet model thread affinity.
|
nullptr /* required for the following moveToThread() call */);
|
||||||
|
|
||||||
|
// Move WalletModel object to the thread that created the WalletController
|
||||||
|
// object (GUI main thread), instead of the current thread, which could be
|
||||||
|
// an outside wallet thread or RPC thread sending a LoadWallet notification.
|
||||||
|
// This ensures queued signals sent to the WalletModel object will be
|
||||||
|
// handled on the GUI event loop.
|
||||||
wallet_model->moveToThread(thread());
|
wallet_model->moveToThread(thread());
|
||||||
// setParent(parent) must be called in the thread which created the parent object. More details in #18948.
|
// setParent(parent) must be called in the thread which created the parent object. More details in #18948.
|
||||||
GUIUtil::ObjectInvoke(this, [wallet_model, this] {
|
GUIUtil::ObjectInvoke(this, [wallet_model, this] {
|
||||||
|
@ -161,7 +167,6 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
|
||||||
// Re-emit coinsSent signal from wallet model.
|
// Re-emit coinsSent signal from wallet model.
|
||||||
connect(wallet_model, &WalletModel::coinsSent, this, &WalletController::coinsSent);
|
connect(wallet_model, &WalletModel::coinsSent, this, &WalletController::coinsSent);
|
||||||
|
|
||||||
// Notify walletAdded signal on the GUI thread.
|
|
||||||
Q_EMIT walletAdded(wallet_model);
|
Q_EMIT walletAdded(wallet_model);
|
||||||
|
|
||||||
return wallet_model;
|
return wallet_model;
|
||||||
|
|
Loading…
Add table
Reference in a new issue