[gnome-shell/wip/fmuellner/gtk4: 34/44] extensions-app: Don't keep ref to main window
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/fmuellner/gtk4: 34/44] extensions-app: Don't keep ref to main window
- Date: Fri, 4 Dec 2020 03:42:44 +0000 (UTC)
commit 165c02547ebf38fe9bd9abd32f82839fa7a19af8
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Nov 18 02:16:26 2020 +0100
extensions-app: Don't keep ref to main window
Unlike in previous GTK version (or Clutter), destroy() no longer
breaks reference cycles but just releases the reference held by
GTK itself.
So if we hold our own reference to the window, closing it won't be
enough to be disposed, and the application won't quit.
There is no good reason for the property anyway, just create the
window on activate if necessary.
subprojects/extensions-app/js/main.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/subprojects/extensions-app/js/main.js b/subprojects/extensions-app/js/main.js
index dc993ef966..21ae2bd878 100644
--- a/subprojects/extensions-app/js/main.js
+++ b/subprojects/extensions-app/js/main.js
@@ -50,7 +50,11 @@ class Application extends Gtk.Application {
vfunc_activate() {
this._shellProxy.CheckForUpdatesRemote();
- this._window.present();
+
+ let { activeWindow } = this;
+ if (!activeWindow)
+ activeWindow = new ExtensionsWindow({ application: this });
+ activeWindow.present();
}
vfunc_startup() {
@@ -68,15 +72,13 @@ class Application extends Gtk.Application {
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
const action = new Gio.SimpleAction({ name: 'quit' });
- action.connect('activate', () => this._window.close());
+ action.connect('activate', () => this.active_window.close());
this.add_action(action);
this.set_accels_for_action('app.quit', ['<Primary>q']);
this._shellProxy = new GnomeShellProxy(Gio.DBus.session,
'org.gnome.Shell.Extensions', '/org/gnome/Shell/Extensions');
-
- this._window = new ExtensionsWindow({ application: this });
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]