--- trunk/src/map-tool.c 2009/11/28 14:20:28 220 +++ trunk/src/map-tool.c 2009/12/02 20:05:52 226 @@ -88,6 +88,9 @@ cb_map_gps(osd_button_t but, map_context_t *context) { if(but == OSD_GPS) { + printf("clicked OSD_GPS %p\n", context); + printf("clicked OSD_GPS a %p\n", context->appdata); + pos_t *refpos = get_pos(context->appdata); if(refpos && !isnan(refpos->lat) && !isnan(refpos->lon)) { gint zoom; @@ -115,17 +118,16 @@ static gboolean map_gps_update(gpointer data) { map_context_t *context = (map_context_t*)data; - static gboolean goto_is_enabled = FALSE; /* get reference position ... */ pos_t *refpos = get_pos(context->appdata); gboolean ok = (refpos!= NULL) && !isnan(refpos->lat) && !isnan(refpos->lon); /* ... and enable "goto" button if it's valid */ - if(ok != goto_is_enabled) { + if(ok != context->goto_is_enabled) { osm_gps_map_osd_enable_gps (OSM_GPS_MAP(context->widget), OSM_GPS_MAP_OSD_CALLBACK(ok?cb_map_gps:NULL), context); - goto_is_enabled = ok; + context->goto_is_enabled = ok; } if(ok) { @@ -820,6 +822,7 @@ context->caches_displayed = NULL; } + printf("destroy map context\n"); g_free(context); appdata->map.context = NULL; } @@ -910,6 +913,8 @@ } context = appdata->map.context = g_new0(map_context_t, 1); + printf("allocated new context at %p\n", context); + context->appdata = appdata; context->map_complete = FALSE; context->state = MAP_NONE;