[gnome-shell] dialog: Ensure action callback is called with no arguments



commit d8231413601e930a4435734160fc0f44869f3a3f
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>

 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 3e8bfee7d5..9513a8151a 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]