From 8bb7406ba9bdf8a0123acd2b212db9ee77e408f7 Mon Sep 17 00:00:00 2001 From: Jens Lody Date: Sat, 4 Jan 2014 22:25:38 +0100 Subject: [PATCH] Disconnect network monitor if the extension gets stopped. --- src/extension.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/extension.js b/src/extension.js index 7749890..e5869c1 100644 --- a/src/extension.js +++ b/src/extension.js @@ -291,7 +291,7 @@ const WeatherMenuButton = new Lang.Class({ this._network_monitor = Gio.network_monitor_get_default(); this._connected = false; - this._network_monitor.connect('network-changed', Lang.bind(this, this._onNetworkStateChanged)); + this._network_monitor_connection = this._network_monitor.connect('network-changed', Lang.bind(this, this._onNetworkStateChanged)); this._checkConnectionState(); this.menu.connect('open-state-changed', Lang.bind(this, this._onOpenStateChanged)); @@ -308,6 +308,11 @@ const WeatherMenuButton = new Lang.Class({ this._timeoutForecast = undefined; + if (this._network_monitor_connection) { + this._network_monitor.disconnect(this._network_monitor_connection); + this._network_monitor_connection = undefined; + } + if (this._settingsC) { this._settings.disconnect(this._settingsC); this._settingsC = undefined;