-
Notifications
You must be signed in to change notification settings - Fork 37.7k
gui: remove assert in walletcontroller & run setparent in gui-qt main thread #18961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
} else { | ||
// Handler callback runs in a different thread so fix wallet model thread affinity. | ||
wallet_model->moveToThread(thread()); | ||
bool invoked = QMetaObject::invokeMethod(this, "addWallet", Qt::QueuedConnection, Q_ARG(WalletModel*, wallet_model)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to suggest to use Qt::BlockingQueuedConnection
instead, so that the caller gets the wallet model with the parent already set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think - it stucks on windows if u do Blocking. Need to check more, but not today.
// Handler callback runs in a different thread so fix wallet model thread affinity. | ||
wallet_model->moveToThread(thread()); | ||
wallet_model->setParent(this); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, remove (IMO).
return wallet_model; | ||
} | ||
|
||
void WalletController::addWallet(WalletModel* wallet_model) | ||
{ | ||
// Take ownership of the wallet model and register it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/register/notify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment must be updated,too (setparent & emit to update gui), ownership already done in if-clause and register was in m_wallets.push_back(wallet_model) - if u change more in walletcontroller.cpp, u should change it.
small fix, u should use setparent() call in qt only if u own the object (thread created the object).