[polari] userList: Disconnect room signals on widget destruction
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] userList: Disconnect room signals on widget destruction
- Date: Mon, 22 Sep 2014 18:37:16 +0000 (UTC)
commit c102d3fbe7cbbcd5c775e1500f78e9efb76e5539
Author: Florian Müllner <fmuellner gnome org>
Date: Sun Sep 21 02:01:05 2014 +0200
userList: Disconnect room signals on widget destruction
Now that the user list lifecycle is no longer tied to the corresponding
room, we need to disconnect the signals when destroying the widget.
https://bugzilla.gnome.org/show_bug.cgi?id=732290
src/userList.js | 52 +++++++++++++++++++++++++++++++++-------------------
1 files changed, 33 insertions(+), 19 deletions(-)
---
diff --git a/src/userList.js b/src/userList.js
index 603d061..e49c88a 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -329,35 +329,49 @@ const UserList = new Lang.Class({
this._list.connect('row-activated',
Lang.bind(this, this._onRowActivated));
+ this.widget.connect('destroy',
+ Lang.bind(this, this._onDestroy));
this._room = room;
this._rows = {};
this._activeRow = null;
- room.connect('member-renamed',
- Lang.bind(this, this._onMemberRenamed));
- room.connect('member-disconnected',
- Lang.bind(this, this._onMemberRemoved));
- room.connect('member-kicked',
- Lang.bind(this, this._onMemberRemoved));
- room.connect('member-banned',
- Lang.bind(this, this._onMemberRemoved));
- room.connect('member-left',
- Lang.bind(this, this._onMemberRemoved));
- room.connect('member-joined',
- Lang.bind(this, this._onMemberJoined));
- /*
- // see https://bugzilla.gnome.org/show_bug.cgi?id=725403
- room.connect('members-changed',
- Lang.bind(this, this._onMembersChanged));
- */
- room.connect('notify::channel',
- Lang.bind(this, this._onChannelChanged));
+ let roomSignals = [
+ { name: 'member-renamed',
+ handler: Lang.bind(this, this._onMemberRenamed) },
+ { name: 'member-disconnected',
+ handler: Lang.bind(this, this._onMemberRemoved) },
+ { name: 'member-kicked',
+ handler: Lang.bind(this, this._onMemberRemoved) },
+ { name: 'member-banned',
+ handler: Lang.bind(this, this._onMemberRemoved) },
+ { name: 'member-left',
+ handler: Lang.bind(this, this._onMemberRemoved) },
+ { name: 'member-joined',
+ handler: Lang.bind(this, this._onMemberJoined) },
+ /*
+ // see https://bugzilla.gnome.org/show_bug.cgi?id=725403
+ { name: 'members-changed',
+ handler: Lang.bind(this, this._onMembersChanged) },
+ */
+ { name: 'notify::channel',
+ handler: Lang.bind(this, this._onChannelChanged) }
+ ];
+ this._roomSignals = [];
+ roomSignals.forEach(Lang.bind(this, function(signal) {
+ this._roomSignals.push(room.connect(signal.name, signal.handler));
+ }));
this._onChannelChanged(room);
this.widget.show_all();
},
+ _onDestroy: function() {
+ for (let i = 0; i < this._roomSignals.length; i++)
+ this._room.disconnect(this._roomSignals[i]);
+ this._roomSignals = [];
+ },
+
setFilter: function(filter) {
this._filter = filter.toLowerCase();
this._list.invalidate_filter();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]