From 4208142d279401a3ae52e74b23a6e3c6c5f10456 Mon Sep 17 00:00:00 2001 From: "Zeeshan Ali (Khattak)" Date: Tue, 7 Apr 2015 17:29:48 +0100 Subject: [PATCH] location-source: Always create new location instance The timestamp on location is only set on it during creation so if we re-use the same location object, we'll have the same timestamp on every new location and hence we won't be able to calculate speed by comparing the new and old locations. Besides the timestamp is supposed to represent the time when location was acquired so keeping it the same throughout the lifetime of geoclue, is just wrong. https://bugs.freedesktop.org/show_bug.cgi?id=89852 --- src/gclue-location-source.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gclue-location-source.c b/src/gclue-location-source.c index 1e362de..9c1a5b9 100644 --- a/src/gclue-location-source.c +++ b/src/gclue-location-source.c @@ -268,14 +268,13 @@ gclue_location_source_set_location (GClueLocationSource *source, GClueLocationSourcePrivate *priv = source->priv; GeocodeLocation *gloc; - if (priv->location == NULL) - priv->location = g_object_new (GCLUE_TYPE_LOCATION, NULL); - gloc = GEOCODE_LOCATION (location); + priv->location = gclue_location_new + (geocode_location_get_latitude (gloc), + geocode_location_get_longitude (gloc), + geocode_location_get_accuracy (gloc)); + g_object_set (priv->location, - "latitude", geocode_location_get_latitude (gloc), - "longitude", geocode_location_get_longitude (gloc), - "accuracy", geocode_location_get_accuracy (gloc), "description", geocode_location_get_description (gloc), "speed", gclue_location_get_speed (location), "heading", gclue_location_get_heading (location), -- 2.1.0