[libgweather/wip/hadess/3.28.3: 6/10] GWeatherTimezone: Fix timezone_cache ref count



commit 6e6a1da4739c936ef0cb0f3ddc029485b9857436
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]