[libgweather/gnome-3-10] GWeatherInfo: abort the SoupSession in dispose(), not finalize()
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/gnome-3-10] GWeatherInfo: abort the SoupSession in dispose(), not finalize()
- Date: Sat, 8 Mar 2014 18:36:39 +0000 (UTC)
commit fb0c210c80cd1842427a5a6a213319a7a6264cec
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 b847e3a..b0d40d1 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);
}
@@ -2117,6 +2128,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]