[libgweather/wip/hadess/serialisation-fix-stable: 6/13] GWeatherTimezone: Fix timezone_cache ref count



commit f51ef766eda10a05df34afef0a1c7d4e85c5e77b
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]