[libgweather] GWeatherLocation: fix handling of detached locations
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather] GWeatherLocation: fix handling of detached locations
- Date: Sun, 14 Jul 2013 12:39:15 +0000 (UTC)
commit 9239d455c126702a2ecf36e23e125bf2a4a66aad
Author: Giovanni Campagna <gcampagn redhat com>
Date: Sat Jul 13 18:40:05 2013 +0200
GWeatherLocation: fix handling of detached locations
The serialization format supports locations which are not present
in the database, and automatically matches them with the nearest
location already known, but it was doing it wrongly and most
important was creating a location that was already freed.
libgweather/gweather-location.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index 151af79..cf69ab4 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -941,6 +941,7 @@ _gweather_location_new_detached (GWeatherLocation *nearest_station,
char *normalized;
self = g_slice_new0 (GWeatherLocation);
+ self->ref_count = 1;
self->level = GWEATHER_LOCATION_DETACHED;
self->name = g_strdup (name);
@@ -1033,7 +1034,7 @@ gweather_location_format_one_deserialize (GWeatherLocation *world,
if (g_strcmp0 (name, city->name) == 0)
found = gweather_location_ref (city);
else
- found = _gweather_location_new_detached (city, name, FALSE, 0, 0);
+ found = _gweather_location_new_detached (ws, name, TRUE, latitude, longitude);
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]