[gnome-shell/gnome-40] dbusServices/extensions: Fix shutdown after showing prefs



commit 205dba202b802af6a2a05f2b8886846d24b0c887
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Oct 28 19:27:57 2021 +0200

    dbusServices/extensions: Fix shutdown after showing prefs
    
    GTK4 relies entirely on refcounting for cleanup (that is,
    there is no longer a destroy() method that forces a dispose
    run regardless of the refcount).
    
    Unfortunately that makes cleanup harder in (some) language
    bindings, where an object may be kept alive implicitly by
    closures etc.
    
    Address this by releasing the hold count when the window
    is closed rather than when it is destroyed.
    
    This isn't the most elegant, but it ensure that the service
    doesn't get stuck if an extension doesn't carefully clean
    up everything in its prefs widget.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4564
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2013>
    (cherry picked from commit 4d2b008966266ed96325dfd2cf7ebe41902aa270)

 js/dbusServices/extensions/extensionsService.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/js/dbusServices/extensions/extensionsService.js b/js/dbusServices/extensions/extensionsService.js
index 6556d3cf31..7fa32fe808 100644
--- a/js/dbusServices/extensions/extensionsService.js
+++ b/js/dbusServices/extensions/extensionsService.js
@@ -133,7 +133,10 @@ var ExtensionsService = class extends ServiceImplementation {
             if (options.modal)
                 window.modal = options.modal.get_boolean();
 
-            window.connect('destroy', () => this.release());
+            window.connect('close-request', () => {
+                this.release();
+                return false;
+            });
             this.hold();
 
             window.show();


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