summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2018-10-09 14:42:19 +0200
committerBastien Nocera <hadess@hadess.net>2019-02-22 17:38:17 +0100
commit6e6a1da4739c936ef0cb0f3ddc029485b9857436 (patch)
treee7b07b80ac5300565c3f9ec19b2cb0f228f6a82d
parent57b290967f98502d9fa2d593fc2001d01d9621af (diff)
downloadlibgweather-6e6a1da4739c936ef0cb0f3ddc029485b9857436.tar.gz
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.
-rw-r--r--libgweather/gweather-timezone.c2
1 files changed, 1 insertions, 1 deletions
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;
}