[gnome-shell/gnome-3-38] dialog: Ensure action callback is called with no arguments
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-38] dialog: Ensure action callback is called with no arguments
- Date: Thu, 10 Jun 2021 19:12:20 +0000 (UTC)
commit 391942da2f492994b4c1bbf592cb1a13212f927a
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Apr 19 18:37:58 2021 +0200
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>
(cherry picked from commit d8231413601e930a4435734160fc0f44869f3a3f)
js/ui/dialog.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/js/ui/dialog.js b/js/ui/dialog.js
index bb54ac0291..f2b6feefcd 100644
--- a/js/ui/dialog.js
+++ b/js/ui/dialog.js
@@ -133,7 +133,7 @@ class Dialog extends St.Widget {
y_expand: true,
label,
});
- button.connect('clicked', action);
+ button.connect('clicked', () => action());
buttonInfo['button'] = button;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]