endSessionDialog: Don't emit 'closed' until handler is connected

Prior to commit 7bd98f3f5f animation
onComplete handlers always occured at least after one main loop
iteration.

Now, if animations are disabled, they can get invoked immediately.

That breaks the endSessionDialog button handler, which calls
close before setting up the "closed" signal handler.

This commit fixes the handler to get set up first.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2677>
This commit is contained in:
Ray Strode 2023-03-05 20:00:42 -05:00
parent e1faadf0d0
commit 07dfcf4eff

View File

@ -447,11 +447,11 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
let label = dialogContent.confirmButtons[i].label;
let button = this.addButton({
action: () => {
this.close(true);
let signalId = this.connect('closed', () => {
this.disconnect(signalId);
this._confirm(signal);
});
this.close(true);
},
label,
});