[gnome-calendar/mcatanzaro/weather-service-safety] Properly disconnect GcalWeatherService from its GWeatherInfo
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/mcatanzaro/weather-service-safety] Properly disconnect GcalWeatherService from its GWeatherInfo
- Date: Wed, 3 Jul 2019 16:49:56 +0000 (UTC)
commit 1f8f91f598bf04c174f5045d8716aeda16bd56b9
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Wed Jul 3 11:47:55 2019 -0500
Properly disconnect GcalWeatherService from its GWeatherInfo
We fail to disconnect from the GWeatherInfo in both update_location() and
dispose. We have to fix update_location() manually. To avoid the need to
disconnect in dispose, we can just use g_signal_connect_object().
src/weather/gcal-weather-service.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/weather/gcal-weather-service.c b/src/weather/gcal-weather-service.c
index 5ca08a27..828a89bc 100644
--- a/src/weather/gcal-weather-service.c
+++ b/src/weather/gcal-weather-service.c
@@ -476,7 +476,11 @@ update_location (GcalWeatherService *self,
if (gcal_timer_is_running (self->duration_timer))
stop_timer (self);
- g_clear_object (&self->gweather_info);
+ if (self->gweather_info != NULL)
+ {
+ g_signal_handlers_disconnect_by_data (self->gweather_info, self);
+ g_clear_object (&self->gweather_info);
+ }
if (!location)
{
@@ -496,7 +500,7 @@ update_location (GcalWeatherService *self,
* what is going on.
*/
gweather_info_set_enabled_providers (self->gweather_info, GWEATHER_PROVIDER_METAR |
GWEATHER_PROVIDER_OWM | GWEATHER_PROVIDER_YR_NO);
- g_signal_connect (self->gweather_info, "updated", (GCallback) on_gweather_update_cb, self);
+ g_signal_connect_object (self->gweather_info, "updated", (GCallback) on_gweather_update_cb, self, 0);
/*
* gweather_info_update might or might not trigger a
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]