summaryrefslogtreecommitdiff
path: root/navit/navigation.c
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2011-12-11 23:15:37 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2011-12-11 23:15:37 +0000
commit71ac2d10c3dfe61df78c7ad786f3a26e144df92e (patch)
treeb3a99e342fc16e3db3241c776e9ce62dfc8e348d /navit/navigation.c
parent80ccaafc44c267372214e2663bee031929fa5e64 (diff)
downloadnavit-71ac2d10c3dfe61df78c7ad786f3a26e144df92e.tar.gz
Fix:Core:Handle multiple calls to navigation_set_route correctly
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@4857 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/navigation.c')
-rw-r--r--navit/navigation.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/navit/navigation.c b/navit/navigation.c
index 2288d43b0..8f44c3ed1 100644
--- a/navit/navigation.c
+++ b/navit/navigation.c
@@ -2350,11 +2350,19 @@ void
navigation_set_route(struct navigation *this_, struct route *route)
{
struct attr callback;
- this_->route=route;
- this_->route_cb=callback_new_attr_1(callback_cast(navigation_update), attr_route_status, this_);
+ if (!this_->route_cb)
+ this_->route_cb=callback_new_attr_1(callback_cast(navigation_update), attr_route_status, this_);
callback.type=attr_callback;
callback.u.callback=this_->route_cb;
- route_add_attr(route, &callback);
+ if (this_->route)
+ route_remove_attr(this_->route, &callback);
+ this_->route=route;
+ if (this_->route) {
+ struct attr route_status;
+ route_add_attr(this_->route, &callback);
+ if (route_get_attr(this_->route, attr_route_status, &route_status, NULL))
+ navigation_update(this_, this_->route, &route_status);
+ }
}
void