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;