[libgweather/wip/hadess/serialisation-fix: 3/18] GWeatherTimezone: Fix timezone_cache ref count
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/wip/hadess/serialisation-fix: 3/18] GWeatherTimezone: Fix timezone_cache ref count
- Date: Tue, 9 Oct 2018 18:22:42 +0000 (UTC)
commit 8b744f0a97a15a6b76429074c14632fdf4e93ca7
Author: Bastien Nocera <hadess hadess net>
Date: Tue Oct 9 14:42:19 2018 +0200
GWeatherTimezone: Fix timezone_cache ref count
The timezone cache hashtable expected to hold a reference to the
timezone (as it has an destroy function for it), but the single
reference to that timezone had was to be the caller of parse_timezone().
Reference the timezone object before putting it in the hashtable, so
each can keep their own reference.
libgweather/gweather-timezone.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/libgweather/gweather-timezone.c b/libgweather/gweather-timezone.c
index 96d0f9d..185c630 100644
--- a/libgweather/gweather-timezone.c
+++ b/libgweather/gweather-timezone.c
@@ -219,7 +219,7 @@ parse_timezone (GWeatherParser *parser)
zone->has_dst = has_dst;
zone->dst_offset = dst_offset;
- g_hash_table_insert (parser->timezone_cache, zone->id, zone);
+ g_hash_table_insert (parser->timezone_cache, zone->id, gweather_timezone_ref (zone));
name = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]