[polari/wip/fmuellner/invalid-object-access: 4/9] chatView: Disconnect ::room-focus-changed
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/invalid-object-access: 4/9] chatView: Disconnect ::room-focus-changed
- Date: Sat, 9 Dec 2017 22:11:11 +0000 (UTC)
commit 4eaa046e40f8926baefba7213cbda1f30b1b0941
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Dec 6 00:35:13 2017 +0100
chatView: Disconnect ::room-focus-changed
The chat log is not bound to the life time of the application, so
we need to disconnect any handlers to avoid accessing invalidated
objects.
https://gitlab.gnome.org/GNOME/polari/issues/32
src/chatView.js | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index fd4e6ba..09cf902 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -364,8 +364,9 @@ var ChatView = GObject.registerClass({
this._app = Gio.Application.get_default();
DropTargetIface.addTargets(this, this._view);
- this._app.connect('room-focus-changed',
- this._checkMessages.bind(this));
+ this._roomFocusChangedId =
+ this._app.connect('room-focus-changed',
+ this._checkMessages.bind(this));
this._hoverCursor = Gdk.Cursor.new_from_name(this.get_display(),
'pointer');
@@ -510,6 +511,10 @@ var ChatView = GObject.registerClass({
this._room.disconnect(this._roomSignals[i]);
this._roomSignals = [];
+ if (this._roomFocusChangedId)
+ this._app.disconnect(this._roomFocusChangedId);
+ this._roomFocusChangedId = 0;
+
if (this._backlogTimeoutId)
Mainloop.source_remove(this._backlogTimeoutId);
this._backlogTimeoutId = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]