Skip to content

Conversation

promag
Copy link
Contributor

@promag promag commented Nov 12, 2019

This PR makes coin selection work when multiple wallets are loaded - each loaded wallet has it's own coin control dialog.

Closes #15725.

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 12, 2019

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.

@promag
Copy link
Contributor Author

promag commented Nov 12, 2019

Note to reviewers: previously CoinControlDialog::updateLabels was called with 2 different "dialogs" (CoinControlDialog and SendCoinsDialog) and both have the same set of labels except for labelCoinControlInsuffFunds. So, in order to remove static members and usages of findChild, most of the code of updateLabels is now duplicate.

Let me know if you prefer the 2nd commit split. IMO I'd prefer to follow up later.

@DrahtBot DrahtBot added the GUI label Nov 12, 2019
@jonasschnelli
Copy link
Contributor

Travis seems to fail:

qt/coincontroldialog.cpp: In member functionvoid CoinControlDialog::updateView()’:
3030qt/coincontroldialog.cpp:607:84: error: invalid conversion fromCoinControlDialog*toint’ [-fpermissive]
3031         CCoinControlWidgetItem *itemWalletAddress = new CCoinControlWidgetItem(this);
3032                                                                                    ^
3033In file included from qt/coincontroldialog.cpp:9:0:
3034./qt/coincontroldialog.h:35:14: note:   initializing argument 1 ofCCoinControlWidgetItem::CCoinControlWidgetItem(int)’
3035     explicit CCoinControlWidgetItem(int type = Type) : QTreeWidgetItem(type) {}

@promag promag force-pushed the 2019-11-fix-15725 branch 5 times, most recently from 504c0e3 to b89c577 Compare November 17, 2019 01:32
@promag
Copy link
Contributor Author

promag commented Nov 17, 2019

@jonasschnelli all fixed.

Copy link
Member

@Sjors Sjors left a comment

Choose a reason for hiding this comment

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

I can confirm this fixes #15725, but 7b5b91f introduces a new issue: if you select some coins, close the coin control dialog, click Clear All, then reopen the coin control dialog, the coins are still selected.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

Concept ACK.

CoinControlDialog* SendCoinsDialog::coinControlDialog()
{
if (!m_coin_control_dialog) {
m_coin_control_dialog = new CoinControlDialog(platformStyle, this);
Copy link
Member

Choose a reason for hiding this comment

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

Assigning a parent to a QDialog widget changes its default location.
Is it desirable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so, at least it looked fine to me.

{
if (!m_coin_control_dialog) {
m_coin_control_dialog = new CoinControlDialog(platformStyle, this);
m_coin_control_dialog->setModel(model);
Copy link
Member

Choose a reason for hiding this comment

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

Why not pass model to the CoinControlDialog constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can make that change, but I think it's unrelated here.

Copy link
Member

Choose a reason for hiding this comment

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

We use the setModel() approach in various places where the model isn't known at construction time, but that's not the case here. But agree it's not really related.

dlg.setModel(model);
dlg.exec();
coinControlUpdateLabels();
coinControlDialog()->open();
Copy link
Member

Choose a reason for hiding this comment

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

Notes for other reviewers from Qt docs:

Avoid using this [exec()] function; instead, use open().

@promag
Copy link
Contributor Author

promag commented Nov 20, 2019

@Sjors good catch, will fix.

Comment on lines +536 to +542
QLabel *l1 = ui->labelCoinControlQuantity;
QLabel *l2 = ui->labelCoinControlAmount;
QLabel *l3 = ui->labelCoinControlFee;
QLabel *l4 = ui->labelCoinControlAfterFee;
QLabel *l5 = ui->labelCoinControlBytes;
QLabel *l7 = ui->labelCoinControlLowOutput;
QLabel *l8 = ui->labelCoinControlChange;
Copy link
Member

@hebasto hebasto Nov 20, 2019

Choose a reason for hiding this comment

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

As updateLabels() is a member function now, we could get rid of these intermediate variables (lN). Maybe scriptdiff?
This will improve code readability significantly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree but I think that refactor, and others like #17457 (comment), could come next.

I'm also very tempted to fix other things, but I just want to ditch the static coin control to fix the issue.

Copy link
Member

Choose a reason for hiding this comment

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

@promag Agree with your point.

@hebasto
Copy link
Member

hebasto commented Nov 20, 2019

If CoinControlDialog was open once, the output list is not updated when new coins arrive.

@instagibbs
Copy link
Member

@gwillen take a look at this?

@gwillen
Copy link
Contributor

gwillen commented Jan 27, 2020

Sorry for the delay, I am happy to take a look, but I'm getting the same build failure that Travis is seeing. Not sure why only some Travis builds get it and not others.

(EDIT, I misread before:) Looks like a rebase refactored something and you need to update a callsite to match.

@promag
Copy link
Contributor Author

promag commented Jan 27, 2020

@gwillen I'll fix the build, sorry.

@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

@promag
Copy link
Contributor Author

promag commented May 5, 2020

Created #18894 with just the fix. I'll submit the remaining changes later.

@promag promag closed this May 5, 2020
@promag promag deleted the 2019-11-fix-15725 branch May 5, 2020 23:31
jonasschnelli added a commit that referenced this pull request May 13, 2020
e8123ea gui: Fix itemWalletAddress leak when not tree mode (João Barbosa)

Pull request description:

  Taken from #17457, the first commit is a similar to 88a94f7 but for test binary, and the second commit fixes a leak where `CCoinControlWidgetItem` are unnecessarily created and leaked.

ACKs for top commit:
  jonasschnelli:
    utACK e8123ea
  hebasto:
    ACK e8123ea, tested on Linux Mint 19.3.

Tree-SHA512: 8b43cb29de103842ce5f048de51222919540d3212d2873c16731145e856178644041924ad0e9a58c2ff08f209a9b4ac26dc9965289eb719da233c0984f93631e
jonasschnelli added a commit that referenced this pull request May 13, 2020
a8b5f1b gui: Fix manual coin control with multiple wallets loaded (João Barbosa)

Pull request description:

  This PR ensures each loaded wallet has a dedicated coin control in the send view which is manipulated by the coin control dialog.

  This is an alternative to #17457. Two main differences are:
   - scope reduced - no unnecessary changes unrelated to the fix;
   - approach taken - coin control instance now belongs to the send view.

  All problems raised in #17457 reviews no longer apply due to the approach taken - #17457 (review) and #17457 (comment))

  No change in behavior if only one wallet is loaded.

  Closes #15725.

ACKs for top commit:
  jonasschnelli:
    utACK a8b5f1b
  ryanofsky:
    Code review ACK a8b5f1b. Code changes are very straightforward, just replacing global CCoinControl object with SendCoinsDialog member. Not sure if this means coin control settings are reset between payments. It would be good to note in the PR description or release notes if single wallet behavior is affected
  hebasto:
    ACK a8b5f1b
  Sjors:
    tACK a8b5f1b

Tree-SHA512: 3ad9c51bab6f28ec0e90efbd6f43fa510c81dafb2eff0b8c3724efcee3e030054a10be013e27cefe35763374c5f6d7af8c02658736964f733d7e38b646b5df65
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 14, 2020
e8123ea gui: Fix itemWalletAddress leak when not tree mode (João Barbosa)

Pull request description:

  Taken from bitcoin#17457, the first commit is a similar to 88a94f7 but for test binary, and the second commit fixes a leak where `CCoinControlWidgetItem` are unnecessarily created and leaked.

ACKs for top commit:
  jonasschnelli:
    utACK e8123ea
  hebasto:
    ACK e8123ea, tested on Linux Mint 19.3.

Tree-SHA512: 8b43cb29de103842ce5f048de51222919540d3212d2873c16731145e856178644041924ad0e9a58c2ff08f209a9b4ac26dc9965289eb719da233c0984f93631e
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 14, 2020
…ts loaded

a8b5f1b gui: Fix manual coin control with multiple wallets loaded (João Barbosa)

Pull request description:

  This PR ensures each loaded wallet has a dedicated coin control in the send view which is manipulated by the coin control dialog.

  This is an alternative to bitcoin#17457. Two main differences are:
   - scope reduced - no unnecessary changes unrelated to the fix;
   - approach taken - coin control instance now belongs to the send view.

  All problems raised in bitcoin#17457 reviews no longer apply due to the approach taken - bitcoin#17457 (review) and bitcoin#17457 (comment))

  No change in behavior if only one wallet is loaded.

  Closes bitcoin#15725.

ACKs for top commit:
  jonasschnelli:
    utACK a8b5f1b
  ryanofsky:
    Code review ACK a8b5f1b. Code changes are very straightforward, just replacing global CCoinControl object with SendCoinsDialog member. Not sure if this means coin control settings are reset between payments. It would be good to note in the PR description or release notes if single wallet behavior is affected
  hebasto:
    ACK a8b5f1b
  Sjors:
    tACK a8b5f1b

Tree-SHA512: 3ad9c51bab6f28ec0e90efbd6f43fa510c81dafb2eff0b8c3724efcee3e030054a10be013e27cefe35763374c5f6d7af8c02658736964f733d7e38b646b5df65
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Oct 16, 2020
…ts loaded

a8b5f1b gui: Fix manual coin control with multiple wallets loaded (João Barbosa)

Pull request description:

  This PR ensures each loaded wallet has a dedicated coin control in the send view which is manipulated by the coin control dialog.

  This is an alternative to bitcoin#17457. Two main differences are:
   - scope reduced - no unnecessary changes unrelated to the fix;
   - approach taken - coin control instance now belongs to the send view.

  All problems raised in bitcoin#17457 reviews no longer apply due to the approach taken - bitcoin#17457 (review) and bitcoin#17457 (comment))

  No change in behavior if only one wallet is loaded.

  Closes bitcoin#15725.

ACKs for top commit:
  jonasschnelli:
    utACK a8b5f1b
  ryanofsky:
    Code review ACK a8b5f1b. Code changes are very straightforward, just replacing global CCoinControl object with SendCoinsDialog member. Not sure if this means coin control settings are reset between payments. It would be good to note in the PR description or release notes if single wallet behavior is affected
  hebasto:
    ACK a8b5f1b
  Sjors:
    tACK a8b5f1b

Tree-SHA512: 3ad9c51bab6f28ec0e90efbd6f43fa510c81dafb2eff0b8c3724efcee3e030054a10be013e27cefe35763374c5f6d7af8c02658736964f733d7e38b646b5df65
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Oct 16, 2020
…ts loaded

a8b5f1b gui: Fix manual coin control with multiple wallets loaded (João Barbosa)

Pull request description:

  This PR ensures each loaded wallet has a dedicated coin control in the send view which is manipulated by the coin control dialog.

  This is an alternative to bitcoin#17457. Two main differences are:
   - scope reduced - no unnecessary changes unrelated to the fix;
   - approach taken - coin control instance now belongs to the send view.

  All problems raised in bitcoin#17457 reviews no longer apply due to the approach taken - bitcoin#17457 (review) and bitcoin#17457 (comment))

  No change in behavior if only one wallet is loaded.

  Closes bitcoin#15725.

ACKs for top commit:
  jonasschnelli:
    utACK a8b5f1b
  ryanofsky:
    Code review ACK a8b5f1b. Code changes are very straightforward, just replacing global CCoinControl object with SendCoinsDialog member. Not sure if this means coin control settings are reset between payments. It would be good to note in the PR description or release notes if single wallet behavior is affected
  hebasto:
    ACK a8b5f1b
  Sjors:
    tACK a8b5f1b

Tree-SHA512: 3ad9c51bab6f28ec0e90efbd6f43fa510c81dafb2eff0b8c3724efcee3e030054a10be013e27cefe35763374c5f6d7af8c02658736964f733d7e38b646b5df65
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Oct 16, 2020
…ts loaded

a8b5f1b gui: Fix manual coin control with multiple wallets loaded (João Barbosa)

Pull request description:

  This PR ensures each loaded wallet has a dedicated coin control in the send view which is manipulated by the coin control dialog.

  This is an alternative to bitcoin#17457. Two main differences are:
   - scope reduced - no unnecessary changes unrelated to the fix;
   - approach taken - coin control instance now belongs to the send view.

  All problems raised in bitcoin#17457 reviews no longer apply due to the approach taken - bitcoin#17457 (review) and bitcoin#17457 (comment))

  No change in behavior if only one wallet is loaded.

  Closes bitcoin#15725.

ACKs for top commit:
  jonasschnelli:
    utACK a8b5f1b
  ryanofsky:
    Code review ACK a8b5f1b. Code changes are very straightforward, just replacing global CCoinControl object with SendCoinsDialog member. Not sure if this means coin control settings are reset between payments. It would be good to note in the PR description or release notes if single wallet behavior is affected
  hebasto:
    ACK a8b5f1b
  Sjors:
    tACK a8b5f1b

Tree-SHA512: 3ad9c51bab6f28ec0e90efbd6f43fa510c81dafb2eff0b8c3724efcee3e030054a10be013e27cefe35763374c5f6d7af8c02658736964f733d7e38b646b5df65
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Oct 16, 2020
…ts loaded

a8b5f1b gui: Fix manual coin control with multiple wallets loaded (João Barbosa)

Pull request description:

  This PR ensures each loaded wallet has a dedicated coin control in the send view which is manipulated by the coin control dialog.

  This is an alternative to bitcoin#17457. Two main differences are:
   - scope reduced - no unnecessary changes unrelated to the fix;
   - approach taken - coin control instance now belongs to the send view.

  All problems raised in bitcoin#17457 reviews no longer apply due to the approach taken - bitcoin#17457 (review) and bitcoin#17457 (comment))

  No change in behavior if only one wallet is loaded.

  Closes bitcoin#15725.

ACKs for top commit:
  jonasschnelli:
    utACK a8b5f1b
  ryanofsky:
    Code review ACK a8b5f1b. Code changes are very straightforward, just replacing global CCoinControl object with SendCoinsDialog member. Not sure if this means coin control settings are reset between payments. It would be good to note in the PR description or release notes if single wallet behavior is affected
  hebasto:
    ACK a8b5f1b
  Sjors:
    tACK a8b5f1b

Tree-SHA512: 3ad9c51bab6f28ec0e90efbd6f43fa510c81dafb2eff0b8c3724efcee3e030054a10be013e27cefe35763374c5f6d7af8c02658736964f733d7e38b646b5df65
UdjinM6 added a commit to dashpay/dash that referenced this pull request Nov 9, 2020
…aded (#3777)

* Merge bitcoin#18894: gui: Fix manual coin control with multiple wallets loaded

a8b5f1b gui: Fix manual coin control with multiple wallets loaded (João Barbosa)

Pull request description:

  This PR ensures each loaded wallet has a dedicated coin control in the send view which is manipulated by the coin control dialog.

  This is an alternative to bitcoin#17457. Two main differences are:
   - scope reduced - no unnecessary changes unrelated to the fix;
   - approach taken - coin control instance now belongs to the send view.

  All problems raised in bitcoin#17457 reviews no longer apply due to the approach taken - bitcoin#17457 (review) and bitcoin#17457 (comment))

  No change in behavior if only one wallet is loaded.

  Closes bitcoin#15725.

ACKs for top commit:
  jonasschnelli:
    utACK a8b5f1b
  ryanofsky:
    Code review ACK a8b5f1b. Code changes are very straightforward, just replacing global CCoinControl object with SendCoinsDialog member. Not sure if this means coin control settings are reset between payments. It would be good to note in the PR description or release notes if single wallet behavior is affected
  hebasto:
    ACK a8b5f1b
  Sjors:
    tACK a8b5f1b

Tree-SHA512: 3ad9c51bab6f28ec0e90efbd6f43fa510c81dafb2eff0b8c3724efcee3e030054a10be013e27cefe35763374c5f6d7af8c02658736964f733d7e38b646b5df65

* Update src/qt/coincontroldialog.cpp

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: Jonas Schnelli <dev@jonasschnelli.ch>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
e8123ea gui: Fix itemWalletAddress leak when not tree mode (João Barbosa)

Pull request description:

  Taken from bitcoin#17457, the first commit is a similar to 88a94f7 but for test binary, and the second commit fixes a leak where `CCoinControlWidgetItem` are unnecessarily created and leaked.

ACKs for top commit:
  jonasschnelli:
    utACK e8123ea
  hebasto:
    ACK e8123ea, tested on Linux Mint 19.3.

Tree-SHA512: 8b43cb29de103842ce5f048de51222919540d3212d2873c16731145e856178644041924ad0e9a58c2ff08f209a9b4ac26dc9965289eb719da233c0984f93631e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
e8123ea gui: Fix itemWalletAddress leak when not tree mode (João Barbosa)

Pull request description:

  Taken from bitcoin#17457, the first commit is a similar to 88a94f7 but for test binary, and the second commit fixes a leak where `CCoinControlWidgetItem` are unnecessarily created and leaked.

ACKs for top commit:
  jonasschnelli:
    utACK e8123ea
  hebasto:
    ACK e8123ea, tested on Linux Mint 19.3.

Tree-SHA512: 8b43cb29de103842ce5f048de51222919540d3212d2873c16731145e856178644041924ad0e9a58c2ff08f209a9b4ac26dc9965289eb719da233c0984f93631e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
e8123ea gui: Fix itemWalletAddress leak when not tree mode (João Barbosa)

Pull request description:

  Taken from bitcoin#17457, the first commit is a similar to 88a94f7 but for test binary, and the second commit fixes a leak where `CCoinControlWidgetItem` are unnecessarily created and leaked.

ACKs for top commit:
  jonasschnelli:
    utACK e8123ea
  hebasto:
    ACK e8123ea, tested on Linux Mint 19.3.

Tree-SHA512: 8b43cb29de103842ce5f048de51222919540d3212d2873c16731145e856178644041924ad0e9a58c2ff08f209a9b4ac26dc9965289eb719da233c0984f93631e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
e8123ea gui: Fix itemWalletAddress leak when not tree mode (João Barbosa)

Pull request description:

  Taken from bitcoin#17457, the first commit is a similar to 88a94f7 but for test binary, and the second commit fixes a leak where `CCoinControlWidgetItem` are unnecessarily created and leaked.

ACKs for top commit:
  jonasschnelli:
    utACK e8123ea
  hebasto:
    ACK e8123ea, tested on Linux Mint 19.3.

Tree-SHA512: 8b43cb29de103842ce5f048de51222919540d3212d2873c16731145e856178644041924ad0e9a58c2ff08f209a9b4ac26dc9965289eb719da233c0984f93631e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
e8123ea gui: Fix itemWalletAddress leak when not tree mode (João Barbosa)

Pull request description:

  Taken from bitcoin#17457, the first commit is a similar to 88a94f7 but for test binary, and the second commit fixes a leak where `CCoinControlWidgetItem` are unnecessarily created and leaked.

ACKs for top commit:
  jonasschnelli:
    utACK e8123ea
  hebasto:
    ACK e8123ea, tested on Linux Mint 19.3.

Tree-SHA512: 8b43cb29de103842ce5f048de51222919540d3212d2873c16731145e856178644041924ad0e9a58c2ff08f209a9b4ac26dc9965289eb719da233c0984f93631e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 14, 2021
e8123ea gui: Fix itemWalletAddress leak when not tree mode (João Barbosa)

Pull request description:

  Taken from bitcoin#17457, the first commit is a similar to 88a94f7 but for test binary, and the second commit fixes a leak where `CCoinControlWidgetItem` are unnecessarily created and leaked.

ACKs for top commit:
  jonasschnelli:
    utACK e8123ea
  hebasto:
    ACK e8123ea, tested on Linux Mint 19.3.

Tree-SHA512: 8b43cb29de103842ce5f048de51222919540d3212d2873c16731145e856178644041924ad0e9a58c2ff08f209a9b4ac26dc9965289eb719da233c0984f93631e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 15, 2021
e8123ea gui: Fix itemWalletAddress leak when not tree mode (João Barbosa)

Pull request description:

  Taken from bitcoin#17457, the first commit is a similar to 88a94f7 but for test binary, and the second commit fixes a leak where `CCoinControlWidgetItem` are unnecessarily created and leaked.

ACKs for top commit:
  jonasschnelli:
    utACK e8123ea
  hebasto:
    ACK e8123ea, tested on Linux Mint 19.3.

Tree-SHA512: 8b43cb29de103842ce5f048de51222919540d3212d2873c16731145e856178644041924ad0e9a58c2ff08f209a9b4ac26dc9965289eb719da233c0984f93631e
@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Manual coin control dialog interacts badly with multiple wallets
7 participants