From 6588d83bf7d0d8c1a3e281535791179cc0e32c6e Mon Sep 17 00:00:00 2001 From: Minjune Kim Date: Fri, 31 Aug 2012 19:11:02 +0900 Subject: Fix a crash after changes that velocity is updated before position Change-Id: I85dd79f95de014f4dc2eadaa8af2082d70477b04 --- debian/changelog | 7 +++++++ location/manager/location-cps.c | 4 ++-- location/manager/location-gps.c | 4 ++-- location/manager/location-hybrid.c | 4 ++-- location/manager/location-signaling-util.c | 7 ++++--- location/manager/location-signaling-util.h | 4 ++-- location/manager/location-wps.c | 4 ++-- packaging/libslp-location.spec | 2 +- 8 files changed, 22 insertions(+), 14 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0848fc8..c96f215 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +libslp-location (0.3.39-1) unstable; urgency=low + + * Fix a crash after changes that velocity is updated before position. + * Tag: libslp-location_0.3.39-1 + + -- Minjune Kim Fri, 31 Aug 2012 19:02:39 +0900 + libslp-location (0.3.38-1) unstable; urgency=low * Add the parameter, LocationMapPref in Geocoder diff --git a/location/manager/location-cps.c b/location/manager/location-cps.c index 5e3b43e..5b76627 100644 --- a/location/manager/location-cps.c +++ b/location/manager/location-cps.c @@ -179,7 +179,7 @@ cps_position_cb (gboolean enabled, } enable_signaling(self, signals, &(priv->enabled), enabled, pos->status); - position_signaling(self, signals, &(priv->enabled), priv->pos_interval, FALSE, &(priv->pos_updated_timestamp), &(priv->pos), &(priv->acc), priv->boundary_list, &(priv->zone_status), pos, acc); + position_signaling(self, signals, &(priv->enabled), priv->pos_interval, FALSE, &(priv->pos_updated_timestamp), &(priv->pos), priv->boundary_list, &(priv->zone_status), pos, acc); } static void @@ -191,7 +191,7 @@ cps_velocity_cb(gboolean enabled, LOCATION_LOGD("cps_velocity_cb"); g_return_if_fail(self); LocationCpsPrivate* priv = GET_PRIVATE(self); - velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, FALSE, &(priv->vel_updated_timestamp), &(priv->vel), vel, acc); + velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, FALSE, &(priv->vel_updated_timestamp), &(priv->vel), &(priv->acc), vel, acc); } static void diff --git a/location/manager/location-gps.c b/location/manager/location-gps.c index 12fee81..a3b44ec 100644 --- a/location/manager/location-gps.c +++ b/location/manager/location-gps.c @@ -182,7 +182,7 @@ gps_position_cb (gboolean enabled, LocationGpsPrivate* priv = GET_PRIVATE(self); enable_signaling(self, signals, &(priv->enabled), enabled, pos->status); - position_signaling(self, signals, &(priv->enabled), priv->pos_interval, TRUE, &(priv->pos_updated_timestamp), &(priv->pos), &(priv->acc), priv->boundary_list, &(priv->zone_status), pos, acc); + position_signaling(self, signals, &(priv->enabled), priv->pos_interval, TRUE, &(priv->pos_updated_timestamp), &(priv->pos), priv->boundary_list, &(priv->zone_status), pos, acc); } @@ -195,7 +195,7 @@ gps_velocity_cb (gboolean enabled, LOCATION_LOGD("gps_velocity_cb"); g_return_if_fail(self); LocationGpsPrivate* priv = GET_PRIVATE(self); - velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, TRUE, &(priv->vel_updated_timestamp), &(priv->vel), vel, acc); + velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, TRUE, &(priv->vel_updated_timestamp), &(priv->vel), &(priv->acc), vel, acc); } static void diff --git a/location/manager/location-hybrid.c b/location/manager/location-hybrid.c index e8c906c..de6b6ec 100644 --- a/location/manager/location-hybrid.c +++ b/location/manager/location-hybrid.c @@ -308,10 +308,10 @@ hybrid_service_updated (GObject *obj, if (hybrid_compare_g_type_method(priv, g_type)) { LocationAccuracy *acc = (LocationAccuracy*)accuracy; if (type == POSITION_UPDATED) { - position_signaling(self, signals, &(priv->enabled), priv->pos_interval, TRUE, &(priv->pos_updated_timestamp), &(priv->pos), &(priv->acc), priv->boundary_list, &(priv->zone_status), pos, acc); + position_signaling(self, signals, &(priv->enabled), priv->pos_interval, TRUE, &(priv->pos_updated_timestamp), &(priv->pos), priv->boundary_list, &(priv->zone_status), pos, acc); LOCATION_LOGW("Position updated. timestamp [%d]", priv->pos->timestamp); } else if (type == VELOCITY_UPDATED) { - velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, TRUE, &(priv->vel_updated_timestamp), &(priv->vel), vel, acc); + velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, TRUE, &(priv->vel_updated_timestamp), &(priv->vel), &(priv->acc), vel, acc); LOCATION_LOGW("Velocity updated. timestamp [%d]", priv->vel->timestamp); } diff --git a/location/manager/location-signaling-util.c b/location/manager/location-signaling-util.c index 7b11c3f..e262bda 100644 --- a/location/manager/location-signaling-util.c +++ b/location/manager/location-signaling-util.c @@ -55,7 +55,6 @@ position_signaling (LocationObject *obj, gboolean emit, guint *updated_timestamp, LocationPosition **prev_pos, - LocationAccuracy **prev_acc, GList *prev_bound, ZoneStatus *zone_status, const LocationPosition *pos, @@ -75,10 +74,8 @@ position_signaling (LocationObject *obj, if (!pos->timestamp) return; if (*prev_pos) location_position_free (*prev_pos); - if (*prev_acc) location_accuracy_free (*prev_acc); *prev_pos = location_position_copy(pos); - *prev_acc = location_accuracy_copy(acc); LOCATION_LOGD("timestamp[%d], lat [%f], lon [%f]", (*prev_pos)->timestamp, (*prev_pos)->latitude, (*prev_pos)->longitude); if (emit && pos->timestamp - *updated_timestamp >= interval) { @@ -121,6 +118,7 @@ velocity_signaling (LocationObject *obj, gboolean emit, guint *updated_timestamp, LocationVelocity **prev_vel, + LocationAccuracy **prev_acc, const LocationVelocity *vel, const LocationAccuracy *acc) { @@ -131,7 +129,10 @@ velocity_signaling (LocationObject *obj, if (!vel->timestamp) return; if (*prev_vel) location_velocity_free (*prev_vel); + if (*prev_acc) location_accuracy_free (*prev_acc); + *prev_vel = location_velocity_copy (vel); + *prev_acc = location_accuracy_copy (acc); LOCATION_LOGD("timestamp[%d]", (*prev_vel)->timestamp); if (emit && vel->timestamp - *updated_timestamp >= interval) { diff --git a/location/manager/location-signaling-util.h b/location/manager/location-signaling-util.h index 8854169..db2504e 100644 --- a/location/manager/location-signaling-util.h +++ b/location/manager/location-signaling-util.h @@ -42,13 +42,13 @@ void enable_signaling (LocationObject *obj, guint32 signals[LAST_SIGNAL], gboole void position_signaling (LocationObject *obj, guint32 signals[LAST_SIGNAL], gboolean *prev_enabled, int interval, gboolean emit, - guint *updated_interval, LocationPosition **prev_pos, LocationAccuracy **prev_acc, + guint *updated_interval, LocationPosition **prev_pos, GList *prev_bound, ZoneStatus *zone_status, const LocationPosition *pos, const LocationAccuracy *acc); void velocity_signaling (LocationObject* obj, guint32 signals[LAST_SIGNAL], gboolean *prev_enabled, int interval, gboolean emit, - guint *updated_timestamp, LocationVelocity **prev_vel, + guint *updated_timestamp, LocationVelocity **prev_vel, LocationAccuracy **prev_acc, const LocationVelocity *vel, const LocationAccuracy *acc); void satellite_signaling(LocationObject *obj, guint32 signals[LAST_SIGNAL], diff --git a/location/manager/location-wps.c b/location/manager/location-wps.c index 88a871a..7d94438 100644 --- a/location/manager/location-wps.c +++ b/location/manager/location-wps.c @@ -183,7 +183,7 @@ wps_position_cb (gboolean enabled, } enable_signaling(self, signals, &(priv->enabled), enabled, pos->status); - position_signaling(self, signals, &(priv->enabled), priv->pos_interval, FALSE, &(priv->pos_updated_timestamp), &(priv->pos), &(priv->acc), priv->boundary_list, &(priv->zone_status), pos, acc); + position_signaling(self, signals, &(priv->enabled), priv->pos_interval, FALSE, &(priv->pos_updated_timestamp), &(priv->pos), priv->boundary_list, &(priv->zone_status), pos, acc); } static void @@ -195,7 +195,7 @@ wps_velocity_cb(gboolean enabled, LOCATION_LOGD("wps_velocity_cb"); g_return_if_fail(self); LocationWpsPrivate* priv = GET_PRIVATE(self); - velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, FALSE, &(priv->vel_updated_timestamp), &(priv->vel), vel, acc); + velocity_signaling(self, signals, &(priv->enabled), priv->vel_interval, FALSE, &(priv->vel_updated_timestamp), &(priv->vel), &(priv->acc), vel, acc); } static void diff --git a/packaging/libslp-location.spec b/packaging/libslp-location.spec index add3f10..b11d718 100644 --- a/packaging/libslp-location.spec +++ b/packaging/libslp-location.spec @@ -1,6 +1,6 @@ Name: libslp-location Summary: Location Based Service -Version: 0.3.38 +Version: 0.3.39 Release: 1 Group: System/Libraries License: TBD -- cgit v1.2.3