[gnome-shell/gnome-40] main: Make sure Gio._LocalFilePrototype is correct



commit ccf53b60ee1356719e8ee4e0507e569e6b1847f2
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Jul 17 01:12:45 2021 +0200

    main: Make sure Gio._LocalFilePrototype is correct
    
    gjs had to adjust to glib changes, but only did so in 1.68.1.
    
    In order to not break horribly on systems with a combination of
    too-recent-glib and not-recent-enough-gjs, detect when the prototype
    is wrong and override it with the correct one.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4138
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1921>

 js/ui/main.js | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 979fcefa5d..7cfbba3f78 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -97,6 +97,12 @@ let _cssStylesheet = null;
 let _themeResource = null;
 let _oskResource = null;
 
+// Redefine _LocalFilePrototype in case it points to the wrong prototype.
+// See https://gitlab.gnome.org/GNOME/gjs/-/merge_requests/595
+const localFileGType = GObject.type_from_name('GLocalFile');
+if (Gio._LocalFilePrototype.constructor.$gtype !== localFileGType)
+    Gio._LocalFilePrototype = Gio.File.new_for_path('/').constructor.prototype;
+
 Gio._promisify(Gio._LocalFilePrototype, 'delete_async', 'delete_finish');
 Gio._promisify(Gio._LocalFilePrototype, 'touch_async', 'touch_finish');
 


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