GNOME Bugzilla – Bug 776170
GWeatherLocation.timezone_cache never initialized
Last modified: 2016-12-22 15:53:31 UTC
I'm pretty sure it's meant to be a reference to the timezone_cache in GWeatherParser, probably in location_new_from_xml(), but this never happens. As a result, any call to gweather_timezone_get_by_tzid() will inevitably cause a CRITICAL message and return NULL.
Created attachment 342061 [details] [review] location: initialize timezone_cache
Created attachment 342062 [details] [review] parser: fix g_hash_table_unref(NULL) If _gweather_parser_new fails (because the Location.xml cannot be found, say), then _gweather_parser_free() is called on a GWeatherParser that has not been fully initialized.
Created attachment 342063 [details] [review] parser: don't leak timezone_cache
Review of attachment 342062 [details] [review]: ::: libgweather/gweather-parser.c @@ +201,3 @@ xmlFreeTextReader (parser->xml); + if (parser->metar_code_cache) + g_hash_table_unref (parser->metar_code_cache); g_clear_pointer()?
Review of attachment 342063 [details] [review]: ::: libgweather/gweather-parser.c @@ +203,3 @@ g_hash_table_unref (parser->metar_code_cache); + if (parser->timezone_cache) + g_hash_table_unref (parser->timezone_cache); Ditto.
Created attachment 342065 [details] [review] parser: fix g_hash_table_unref(NULL) If _gweather_parser_new fails (because the Location.xml cannot be found, say), then _gweather_parser_free() is called on a GWeatherParser that has not been fully initialized.
Created attachment 342066 [details] [review] parser: don't leak timezone_cache
Review of attachment 342065 [details] [review]: Looks good.
Review of attachment 342066 [details] [review]: Yeah
Review of attachment 342061 [details] [review]: Not sure at what point this feature was added, or if it ever worked, but it seems correct.
I ended up pushing these myself because I was working in the same spot so I could deal with the rebase conflicts. Thanks for the report and the patches! Attachment 342061 [details] pushed as 07c8179 - location: initialize timezone_cache Attachment 342066 [details] pushed as 5831e58 - parser: don't leak timezone_cache