[polari/wip/fmuellner/warning-fixes: 4/6] mainWindow: Disconnect roomManager signals on destroy
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/warning-fixes: 4/6] mainWindow: Disconnect roomManager signals on destroy
- Date: Mon, 3 Dec 2018 20:07:53 +0000 (UTC)
commit a99b5f5d5c5625c69bffc1a1393b570e746c51f3
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Dec 3 16:14:55 2018 +0100
mainWindow: Disconnect roomManager signals on destroy
The room mananager is a singleton whose lifecycle is tied to the
application, while any widget's lifecycle is tied to the window.
App- and window lifecycle are different when Polari is set up to
keep running in the background, so disconnect the signals to avoid
warnings.
https://gitlab.gnome.org/GNOME/polari/merge_requests/79
src/mainWindow.js | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 13bc030..063cac4 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -160,10 +160,12 @@ var MainWindow = GObject.registerClass({
this._onAccountsChanged(this._accountsMonitor);
this._roomManager = RoomManager.getDefault();
- this._roomManager.connect('rooms-loaded',
- this._onRoomsLoaded.bind(this));
- this._roomManager.connect('room-removed',
- this._onRoomRemoved.bind(this));
+ this._roomsLoadedId =
+ this._roomManager.connect('rooms-loaded',
+ this._onRoomsLoaded.bind(this));
+ this._roomRemovedId =
+ this._roomManager.connect('room-removed',
+ this._onRoomRemoved.bind(this));
this._onRoomsLoaded();
this._updateUserListLabel();
@@ -245,6 +247,9 @@ var MainWindow = GObject.registerClass({
this._settings.reset('last-selected-channel');
this.active_room = null;
+
+ this._roomManager.disconnect(this._roomsLoadedId);
+ this._roomManager.disconnect(this._roomRemovedId);
}
_touchFile(file) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]