Skip to content

Conversation

tarboss
Copy link

@tarboss tarboss commented May 12, 2020

small fix, u should use setparent() call in qt only if u own the object (thread created the object).

@maflcko maflcko changed the title remove assert in walletcontroller & run setparent in gui-qt main thread gui: remove assert in walletcontroller & run setparent in gui-qt main thread May 12, 2020
@DrahtBot DrahtBot added the GUI label May 12, 2020
@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, 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));
Copy link
Contributor

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.

Copy link
Author

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);

Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/register/notify?

Copy link
Author

@tarboss tarboss May 13, 2020

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.

@tarboss tarboss closed this May 15, 2020
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants