-
Notifications
You must be signed in to change notification settings - Fork 37.7k
gui: Fix manual coin control with multiple wallets loaded #17457
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. |
Note to reviewers: previously Let me know if you prefer the 2nd commit split. IMO I'd prefer to follow up later. |
Travis seems to fail: qt/coincontroldialog.cpp: In member function ‘void CoinControlDialog::updateView()’:
3030qt/coincontroldialog.cpp:607:84: error: invalid conversion from ‘CoinControlDialog*’ to ‘int’ [-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 of ‘CCoinControlWidgetItem::CCoinControlWidgetItem(int)’
3035 explicit CCoinControlWidgetItem(int type = Type) : QTreeWidgetItem(type) {} |
504c0e3
to
b89c577
Compare
@jonasschnelli all fixed. |
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.
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.
Concept ACK.
CoinControlDialog* SendCoinsDialog::coinControlDialog() | ||
{ | ||
if (!m_coin_control_dialog) { | ||
m_coin_control_dialog = new CoinControlDialog(platformStyle, 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.
Assigning a parent to a QDialog
widget changes its default location.
Is it desirable?
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 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); |
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.
Why not pass model
to the CoinControlDialog
constructor?
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 can make that change, but I think it's unrelated here.
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.
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(); |
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.
Notes for other reviewers from Qt docs:
Avoid using this [
exec()
] function; instead, useopen()
.
@Sjors good catch, will fix. |
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; |
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.
As updateLabels()
is a member function now, we could get rid of these intermediate variables (lN
). Maybe scriptdiff?
This will improve code readability significantly.
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 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.
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.
@promag Agree with your point.
If |
b89c577
to
1d544f7
Compare
@gwillen take a look at this? |
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. |
@gwillen I'll fix the build, sorry. |
🐙 This pull request conflicts with the target branch and needs rebase. |
Created #18894 with just the fix. I'll submit the remaining changes later. |
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
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
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
…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
…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
…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
…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
…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
…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>
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
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
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
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
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
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
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
This PR makes coin selection work when multiple wallets are loaded - each loaded wallet has it's own coin control dialog.
Closes #15725.