[polari] roomList: Disconnect window signals
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] roomList: Disconnect window signals
- Date: Fri, 3 Sep 2021 21:23:35 +0000 (UTC)
commit bf3593701463c0829c3b8b62293b65c158ad1ca2
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Jul 26 21:04:56 2021 +0200
roomList: Disconnect window signals
So far we have just assumed that the toplevel window no longer
emits any signals during destructions. We should properly clean
up after ourselves instead.
Part-of: <https://gitlab.gnome.org/GNOME/polari/-/merge_requests/230>
src/roomList.js | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/roomList.js b/src/roomList.js
index 14ba1fb9..fd6ff396 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -615,11 +615,21 @@ class RoomList extends Gtk.ListBox {
super.vfunc_realize();
const toplevel = this.get_root();
- toplevel.connect('notify::active-room',
- this._activeRoomChanged.bind(this));
+ this._toplevelSignals = [
+ toplevel.connect('notify::active-room',
+ () => this._activeRoomChanged()),
+ ];
this._activeRoomChanged();
}
+ vfunc_unrealize() {
+ super.vfunc_unrealize();
+
+ const toplevel = this.get_root();
+ this._toplevelSignals.forEach(id => toplevel.disconnect(id));
+ this._toplevelSignals = [];
+ }
+
_rowToRoomIndex(index) {
let placeholders = [...this._placeholders.values()];
let nBefore = placeholders.filter(p => p.get_index() < index).length;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]