Page MenuHomePhabricator

gui: replace some QDialog::exec() with safer QDialog::show() calls
ClosedPublic

Authored by PiRK on May 26 2025, 09:00.

Details

Summary

Relevant part of the PR description (core-gui#336):

blocking QDialog::exec() calls are replaced with safer QDialog::show(), except for SendConfirmationDialog as that change is not trivial
The QDialog::open() was not used because the actual modality mode (application modal or window modal) of a dialog depends on whether it has a parent.

This PR does not change behavior, and all touched dialogs are still application modal.
As a follow up, a design research could suggest to make some dialogs window modal.

qt: Add GUIUtil::ShowModalDialogAndDeleteOnClose

https://github.com/bitcoin-core/gui/pull/336/commits/13f618818dc57673ac0287ad8b28ceb450efb374

qt, refactor: Keep OptionsDialog in the main event loop

https://github.com/bitcoin-core/gui/pull/336/commits/7830cd0b35f315570d744f4d2719104c08b33ff1

qt, refactor: Keep CoinControlDialog in the main event loop

https://github.com/bitcoin-core/gui/pull/336/commits/59f7ba4fd7a9e4bc73d784ee74d5b777da9cc436

qt, refactor: Keep EditAddressDialog in the main event loop

https://github.com/bitcoin-core/gui/pull/336/commits/6f6fde30e7601185a8f6052b3bf1770407fcc14b

qt, refactor: Keep AskPassphraseDialog in the main event loop

https://github.com/bitcoin-core/gui/pull/336/commits/7fa91e831227e556bd8a7ae3da64bd59d4f30d5f

qt: Revert 7fa91e831227e556bd8a7ae3da64bd59d4f30d5f partially

The AskPassphraseDialog modal dialog must be synchronous here as
expected in the WalletModel::requestUnlock() function.

Fixed an introduced regression.

https://github.com/bitcoin-core/gui/pull/509/commits/5d7666b15164a16aaf3af49af8f73ff4bd392f6a

qt, refactor: Keep HelpMessageDialog in the main event loop

https://github.com/bitcoin-core/gui/pull/336/commits/332dea2852d9c68f900ed1f0be99b6cea79c7457

scripted-diff: Rename ShowModalDialogAndDeleteOnClose

-BEGIN VERIFY SCRIPT-
sed -i 's/ShowModalDialogAndDeleteOnClose/ShowModalDialogAsynchronously/' -- $(git grep -l -e "ShowModalDialogAndDeleteOnClose")
-END VERIFY SCRIPT-

It is important to highlight that a modal dialog is showed
asynchronously as there are cases when the synchronous QDialog::exec()
is required.

https://github.com/bitcoin-core/gui/pull/509/commits/f730bd7d580502ae3c3b5953ada3724b59f5cd9b

This is a partial backport of core-gui#336 and core-gui#509

Depends on D18146

Test Plan

ninja all check-all

run bitcoin-qt, check that wallet gets locked again after each send (regression fixed by the core-gui#509 commit)

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.May 26 2025, 09:00
src/qt/walletview.cpp
364 ↗(On Diff #54180)

we don't need to connect the updateEncryptionStatus indirection here, we can do the direct signal-to-signal connection like Core does. But we still keep the updateEncryptionStatus function because it is directly called by some other functions (missing wallet backports)

This revision is now accepted and ready to land.May 26 2025, 09:36