Core:Fix:Improve navit_destroy
authorhorwitz <horwitz@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sun, 28 Dec 2008 12:36:52 +0000 (12:36 +0000)
committerhorwitz <horwitz@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sun, 28 Dec 2008 12:36:52 +0000 (12:36 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@1860 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/graphics.c
navit/graphics.h
navit/navit.c

index 5eb04da..b107156 100644 (file)
@@ -176,6 +176,11 @@ void graphics_add_callback(struct graphics *this_, struct callback *cb)
        callback_list_add(this_->cbl, cb);
 }
 
+void graphics_remove_callback(struct graphics *this_, struct callback *cb)
+{
+       callback_list_remove(this_->cbl, cb);
+}
+
 /**
  * FIXME
  * @param <>
index 685ab5e..69e0231 100644 (file)
@@ -129,6 +129,7 @@ struct graphics *graphics_overlay_new(struct graphics *parent, struct point *p,
 void graphics_init(struct graphics *this_);
 void *graphics_get_data(struct graphics *this_, char *type);
 void graphics_add_callback(struct graphics *this_, struct callback *cb);
+void graphics_remove_callback(struct graphics *this_, struct callback *cb);
 struct graphics_font *graphics_font_new(struct graphics *gra, int size, int flags);
 void graphics_font_destroy_all(struct graphics *gra); 
 struct graphics_gc *graphics_gc_new(struct graphics *gra);
index 9e30b6c..08556de 100644 (file)
@@ -2083,6 +2083,16 @@ navit_destroy(struct navit *this_)
        g_free(center_file);
        callback_destroy(navit_command_unregister(this_, "zoom_in"));
        callback_destroy(navit_command_unregister(this_, "zoom_out"));
+       callback_destroy(this_->nav_speech_cb);
+       callback_destroy(this_->roadbook_window);
+       callback_destroy(this_->popup_callback);
+       callback_destroy(this_->motion_timeout_callback);
+       graphics_remove_callback(this_->gra, this_->resize_callback);
+       callback_destroy(this_->resize_callback);
+       graphics_remove_callback(this_->gra, this_->button_callback);
+       callback_destroy(this_->button_callback);
+       graphics_remove_callback(this_->gra, this_->motion_callback);
+       callback_destroy(this_->motion_callback);
        g_hash_table_destroy(this_->commands);
        g_free(this_);
 }