[libgweather] GWeatherInfo: abort the SoupSession in dispose(), not finalize()
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather] GWeatherInfo: abort the SoupSession in dispose(), not finalize()
- Date: Sat, 8 Mar 2014 18:35:37 +0000 (UTC)
commit 5dfa781ccf3194d94287a0ad4cb9222aa7d6eb20
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sat Mar 8 18:41:21 2014 +0100
GWeatherInfo: abort the SoupSession in dispose(), not finalize()
Aborting a SoupSession can call out to arbitrary user code
through the updated signal, and this is not allowed in finalize.
Do it in dispose instead.
libgweather/weather.c | 32 ++++++++++++++++++++++----------
1 files changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/libgweather/weather.c b/libgweather/weather.c
index 830797a..d9b7807 100644
--- a/libgweather/weather.c
+++ b/libgweather/weather.c
@@ -598,22 +598,14 @@ gweather_info_abort (GWeatherInfo *info)
}
static void
-gweather_info_finalize (GObject *object)
+gweather_info_dispose (GObject *object)
{
GWeatherInfo *info = GWEATHER_INFO (object);
GWeatherInfoPrivate *priv = info->priv;
gweather_info_abort (info);
- if (priv->session)
- g_object_unref (priv->session);
- _weather_location_free (&priv->location);
-
- if (priv->glocation)
- gweather_location_unref (priv->glocation);
-
- g_free (priv->radar_url);
- priv->radar_url = NULL;
+ g_clear_object (&priv->session);
free_forecast_list (info);
@@ -622,6 +614,25 @@ gweather_info_finalize (GObject *object)
priv->radar = NULL;
}
+ priv->valid = FALSE;
+
+ G_OBJECT_CLASS (gweather_info_parent_class)->dispose (object);
+}
+
+static void
+gweather_info_finalize (GObject *object)
+{
+ GWeatherInfo *info = GWEATHER_INFO (object);
+ GWeatherInfoPrivate *priv = info->priv;
+
+ _weather_location_free (&priv->location);
+
+ if (priv->glocation)
+ gweather_location_unref (priv->glocation);
+
+ g_free (priv->radar_url);
+ priv->radar_url = NULL;
+
G_OBJECT_CLASS (gweather_info_parent_class)->finalize (object);
}
@@ -2134,6 +2145,7 @@ gweather_info_class_init (GWeatherInfoClass *klass)
g_type_class_add_private (klass, sizeof(GWeatherInfoPrivate));
+ gobject_class->dispose = gweather_info_dispose;
gobject_class->finalize = gweather_info_finalize;
gobject_class->set_property = gweather_info_set_property;
gobject_class->get_property = gweather_info_get_property;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]