[gnome-shell/wip/rstrode/login-screen-extensions: 114/134] viewSelector: Don't set page parent during construction




commit 092180ae084a805c4ece40d481ed71899a6a792e
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Jan 5 21:42:24 2021 +0100

    viewSelector: Don't set page parent during construction
    
    gjs now aggressively garbage-collects objects that fall out of scope,
    sometimes too aggressively:
    
     - we pass a child as construct property to StBin
     - as a result, the child's ::parent-set handler runs
     - when calling clutter_actor_get_parent() from that
       handler, the returned object is garbage-collected
       *before* the constructor returns (and thus the
       assignment that would keep it alive)
    
    This is a bug on the gjs side that should be fixed, but we can easily
    work around the issue by setting the child after constructing the
    parent.

 js/ui/viewSelector.js | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 77146552db..6529ac9a5d 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -301,11 +301,13 @@ var ViewSelector = class {
     _addPage(actor, name, a11yIcon, params) {
         params = Params.parse(params, { a11yFocus: null });
 
-        let page = new St.Bin({ child: actor,
-                                x_align: St.Align.START,
-                                y_align: St.Align.START,
-                                x_fill: true,
-                                y_fill: true });
+        let page = new St.Bin({
+            x_align: St.Align.START,
+            y_align: St.Align.START,
+            x_fill: true,
+            y_fill: true,
+        });
+        page.set_child(actor);
         if (params.a11yFocus)
             Main.ctrlAltTabManager.addGroup(params.a11yFocus, name, a11yIcon);
         else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]