[polari/wip/fmuellner/invalid-object-access: 4/8] 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/8] chatView: Disconnect ::room-focus-changed
- Date: Sat, 9 Dec 2017 21:16:16 +0000 (UTC)
commit 50b756ae2145400af54c1e2a403274adc2139df9
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.
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]