dialog: Ensure action callback is called with no arguments

Using the callback directly as signal handler means that it will
receive the signal parameters (in this case: the StButton instance
that emits the signal).

This leaks an implementation detail that is harmless in the best
case, but can break dialogs when using bind() on the callback.

Avoid that trap by explicitly calling the callback without arguments.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4139

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1819>
This commit is contained in:
Florian Müllner 2021-04-19 18:37:58 +02:00
parent 7eba5322b5
commit d823141360

View File

@ -133,7 +133,7 @@ class Dialog extends St.Widget {
y_expand: true, y_expand: true,
label, label,
}); });
button.connect('clicked', action); button.connect('clicked', () => action());
buttonInfo['button'] = button; buttonInfo['button'] = button;