-
Notifications
You must be signed in to change notification settings - Fork 266
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
Do not exit and re-enter main event loop during shutdown #336
Conversation
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, Tested that each commit can compile and run on its own.
Testing on macOS, some of the dialogs will now open in a subwindow instead of its own window. Here is an example of this:
Master | PR |
---|---|
Specifically the OptionsDialog
, EditAddressDialog
, AskPassphraseDialog
undergo this change compared to master. Interestingly, CoinControlDialog
, PSBTOperationsDialog
, and HelpMessageDialog
all still open up in their own window. It is surprising to me that one set of dialogs behave differently from another set under these changes.
Added a note for reviewers to the OP. |
This change is require for the next commit.
Concept ACK |
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.
Tested ACK 94c395d.
I've tested quitting in different cases, with some dialogs opened, also with the stop RPC command.
Checked all call sites affected by the change to non-blocking.
94c395d
to
451ca24
Compare
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.
ACK 451ca24, just changed signal to quitRequested
.
Let me take a look! |
Code review and lighly tested ACK 451ca24 |
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.
@hebasto Can we revert the changes made in this pull request? |
@prayank23
I'm working on bitcoin/bitcoin#23790 |
@prayank23
Blocking synchronous dialogs are evil for responsible GUI. Only broken part was reverted in #509. |
Compiling PR branch. Will test and comment in PR. Thanks. |
…ion in wallet unlock f730bd7 scripted-diff: Rename ShowModalDialogAndDeleteOnClose (Hennadii Stepanov) 5d7666b qt: Revert 7fa91e8 partially (Hennadii Stepanov) 89c277a qt: Delay shutdown while a modal dialog is active (Hennadii Stepanov) 8c0eb80 qt: Disable tray icon menu when a modal dialog is active (Hennadii Stepanov) 9242735 qt, refactor: Use local QAction instances for the tray icon menu (Hennadii Stepanov) 58e1603 qt, refactor: Drop BitcoinGUI::{send,receive}CoinsMenuAction members (Hennadii Stepanov) fd667e7 qt: Make show_hide_action dependent on the main window actual state (Hennadii Stepanov) ee151d0 qt: Drop BitcoinGUI::toggleHideAction member (Hennadii Stepanov) 78189da qt, refactor: Fill up trayIconMenu before connections (Hennadii Stepanov) 66afa28 qt, refactor: Replace BitcoinGUI::trayIconActivated with a lambda (Hennadii Stepanov) c3ca836 qt, refactor: Replace BitcoinGUI::macosDockIconActivated with a lambda (Hennadii Stepanov) Pull request description: As pointed in #23790 a regression in wallet unlock was introduced in bitcoin-core/gui#336 when a synchronous `AskPassphraseDialog` has been replaced with an asynchronous one. This PR reverts a call back to a synchronous mode. To make synchronous dialogs behave nice during shutdown some additional changes were made. Please note that disabling the tray icon menu when a modal dialog is active is useful itself as on master (4ad5904) it is possible to switch to the "Receive" tab while the GUI is waiting for a password for the "Send" tab: ![Screenshot from 2021-12-17 18-59-51](https://user-images.githubusercontent.com/32963518/146580710-0a755f24-a166-414b-be60-7863232ac778.png) This is confusing and must be avoided. Fixes #23790. ACKs for top commit: prayank23: tACK bitcoin-core/gui@f730bd7 Tree-SHA512: 2b68275754190e4a9831b96e882d3c5b005e03909aeb6f2c5846da07199bb3efbb74ce87a9d25bb139f643c43d377a2051b221d553281fa5aefdd3181a58077f
e7fc506 qt: Override BitcoinApplication::event() to handle QEvent::Quit (Hennadii Stepanov) Pull request description: #336 introduced a regression when termination requests from a platform are not handled properly. This PR fixes this regression. On macOS shutdown after clicking "Quit" in Dock icon menu, and during logout works again. Fixes #545. ACKs for top commit: RandyMcMillan: tACK e7fc506 Sjors: tACK e7fc506 (rebased on master) indeed fixes the crash described in #545 promag: Tested ACK e7fc506 on macOS 10.15 with Qt 5.15.2. Tree-SHA512: 236a483dc0828f22999469e133b8ac9f0b6267ec2a27004c3ebaa967689ddb972ea1fa90c1dd41f3bff3d17bf571a707babcef53bd79fd711fda98cfbf120131
…andle QEvent::Quit e7fc506 qt: Override BitcoinApplication::event() to handle QEvent::Quit (Hennadii Stepanov) Pull request description: bitcoin-core/gui#336 introduced a regression when termination requests from a platform are not handled properly. This PR fixes this regression. On macOS shutdown after clicking "Quit" in Dock icon menu, and during logout works again. Fixes bitcoin-core/gui#545. ACKs for top commit: RandyMcMillan: tACK e7fc506 Sjors: tACK e7fc506 (rebased on master) indeed fixes the crash described in #545 promag: Tested ACK e7fc506 on macOS 10.15 with Qt 5.15.2. Tree-SHA512: 236a483dc0828f22999469e133b8ac9f0b6267ec2a27004c3ebaa967689ddb972ea1fa90c1dd41f3bff3d17bf571a707babcef53bd79fd711fda98cfbf120131
On master (1ef34ee) during shutdown
QApplication
exits the main event loop, then re-enter again.This PR streamlines shutdown process by removing the need to interrupt the main event loop, that is required for #59.
Also, blocking
QDialog::exec()
calls are replaced with saferQDialog::show()
, except forSendConfirmationDialog
as that change is not trivial (marked as TODO).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.
NOTE for reviewers: quitting app while a dialog is open (e.g., via systray icon menu) must work fine.