File libgweather-soup-abort-in-dispose.patch of Package libgweather
From fb0c210c80cd1842427a5a6a213319a7a6264cec Mon Sep 17 00:00:00 2001
From: Giovanni Campagna <gcampagna@src.gnome.org>
Date: Sat, 8 Mar 2014 18:41:21 +0100
Subject: [PATCH 1/2] 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 file 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;
--
1.8.4