[polari/wip/fmuellner/invalid-object-access: 8/10] roomList: Disconnect popover signals
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/invalid-object-access: 8/10] roomList: Disconnect popover signals
- Date: Sun, 10 Dec 2017 15:18:48 +0000 (UTC)
commit f55dc5fde1148e074719c7520ad00f75b19fca75
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Dec 6 01:43:08 2017 +0100
roomList: Disconnect popover signals
If the context popover is visible when the corresponding row is
destroyed - as happens in case the action is triggered from the
popover itself - then the popover's visibility will change one last
time before it is destroyed itself. Accessing the corresponding row
is already invalid in that case, so make sure to disconnect the
signals.
https://gitlab.gnome.org/GNOME/polari/issues/32
src/roomList.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/roomList.js b/src/roomList.js
index f7dc284..95c7c2a 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -27,6 +27,8 @@ var RoomRow = GObject.registerClass({
this._room = room;
this._popover = null;
+ this._popoverVisibleChangedId = 0;
+
this._icon.gicon = room.icon;
this._icon.visible = room.icon != null;
@@ -50,6 +52,10 @@ var RoomRow = GObject.registerClass({
}
this.connect('destroy', () => {
+ if (this._popoverVisibleChangedId)
+ this._popover.disconnect(this._popoverVisibleChangedId);
+ this._popoverVisibleChangedId = 0;
+
room.disconnect(channelChangedId);
this._channelSignals.forEach(id => {
room.channel.disconnect(id);
@@ -176,7 +182,9 @@ var RoomRow = GObject.registerClass({
'app.leave-room(("%s", ""))'.format(this._room.id));
this._popover = Gtk.Popover.new_from_model(this, menu);
- this._popover.connect('notify::visible', _onPopoverVisibleChanged);
+ this._popoverVisibleChangedId =
+ this._popover.connect('notify::visible',
+ _onPopoverVisibleChanged);
this._popover.position = Gtk.PositionType.BOTTOM;
}
this._popover.show();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]