[gnome-documents/gnome-3-16] view: Disconnect from global objects when the widget is destroyed
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/gnome-3-16] view: Disconnect from global objects when the widget is destroyed
- Date: Fri, 10 Apr 2015 17:51:35 +0000 (UTC)
commit 270e87fa0f4d67ec00e7d6ae7e7a92bfe300158e
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Apr 10 13:21:20 2015 +0200
view: Disconnect from global objects when the widget is destroyed
Connections to GObject signals are not broken by disconnectAll. Hence
we need to do it ourselves.
https://bugzilla.gnome.org/show_bug.cgi?id=747506
src/view.js | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/view.js b/src/view.js
index 1d25c4a..cacc060 100644
--- a/src/view.js
+++ b/src/view.js
@@ -344,7 +344,7 @@ const ViewContainer = new Lang.Class({
Lang.bind(this, this._onViewSelectionChanged));
// connect to settings change for list/grid view
- this._viewSettingsId = Application.application.connect('action-state-changed::view-as',
+ let viewSettingsId = Application.application.connect('action-state-changed::view-as',
Lang.bind(this, this._updateTypeForSettings));
this._updateTypeForSettings();
@@ -358,13 +358,13 @@ const ViewContainer = new Lang.Class({
this._onWindowModeChanged();
let selectAll = Application.application.lookup_action('select-all');
- selectAll.connect('activate', Lang.bind(this,
+ let selectAllId = selectAll.connect('activate', Lang.bind(this,
function() {
this.view.select_all();
}));
let selectNone = Application.application.lookup_action('select-none');
- selectNone.connect('activate', Lang.bind(this,
+ let selectNoneId = selectNone.connect('activate', Lang.bind(this,
function() {
this.view.unselect_all();
}));
@@ -388,6 +388,13 @@ const ViewContainer = new Lang.Class({
// this will create the model if we're done querying
this._onQueryStatusChanged();
+
+ this.widget.connect('destroy', Lang.bind(this,
+ function() {
+ Application.application.disconnect(viewSettingsId);
+ selectAll.disconnect(selectAllId);
+ selectNone.disconnect(selectNoneId);
+ }));
},
_updateTypeForSettings: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]