-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Qt: avoid AskPassphraseDialog synchronous QDialog.exec() calls #15313
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
promag
left a comment
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.
Is unique_ptr necessary? Could use deleteLater slot instead?
nit 1, AskPassphraseDialog constructor could do setModal(true)?
nit 2, AskPassphraseDialog could receive wallet model instance?
|
maybe that's a stupid question, but is there any reason not to make a function which opens the dialog? Because to me it looks like it's basically three times the same block of code in the same file with only a different first argument in (Disclaimer: Not a C++ expert) |
|
@flack: you are right. As there are many other places to refactor further. The intention of this PR is to fix a bug and not to refactor code and I propose to do refactoring later. |
fbb01cb to
d3a7392
Compare
|
Followed @promag advice and changed... The by @promag proposed walletModel change should be done in another PR since its a medium size refactor. |
d3a7392 to
92ee869
Compare
|
Thanks for the further optimisation @promag! |
|
Concept ACK |
92ee869 to
5e8dadb
Compare
|
LGTM now utACK 5e8dadb |
promag
left a comment
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.
Crashes with the following:
./src/qt/bitcoin-qt -regtest -wallet=x1 -serverThen open Settings -> Encrypt Wallet..
Confirm and when the following dialog opens: Run./src/bitcoin-cli -regtest unloadwallet x1Should give something like:
bitcoin-qt(70767,0x1116265c0) malloc: *** error for object 0x7ffeecb93160: pointer being freed was not allocated
bitcoin-qt(70767,0x1116265c0) malloc: *** set a breakpoint in malloc_error_break to debug
[1] 70767 abort ./src/qt/bitcoin-qt -regtest -wallet=x1 -server
| dlg.exec(); | ||
|
|
||
| updateEncryptionStatus(); | ||
| AskPassphraseDialog *dlg = new AskPassphraseDialog(status ? AskPassphraseDialog::Encrypt : AskPassphraseDialog::Decrypt, 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, here and below: AskPassphraseDialog* dlg.
|
As said:
There are still a couple of places where dialogs are "synchronous" and this needs to be fixed... but I agree with @promag that the one around encryption should be fixes to cover the complete issue. I'll have a look soon. |
5e8dadb to
2ff23e5
Compare
2ff23e5 to
886bd1f
Compare
|
Combined this with #15614 to gain a safe unloading-wallet behaviour in the GUI |
|
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. |
|
Closing for now in favour of #15614 |


Fixes #15310
If this is an acceptable approach then this shall be adapted (eventually in this PR) to other areas where we use
QDialog.exec().The synchronous
QDialog.exec()call interacts badly with multiwallet (especially unloading wallets).From the Qt docs: