[PATCH 3/4] Destroy the divelist (tree) before calling gtk_main_quit()

Dirk Hohndel dirk at hohndel.org
Mon Oct 1 20:55:23 PDT 2012


While technically this is correct (and I will apply this), it's kind of
irrelevant as we are exiting the app...

/D

"Lubomir I. Ivanov" <neolit123 at gmail.com> writes:

> From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
>
> Added new function dive_list_destroy() in divelist.c
>
> Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
> ---
>  display-gtk.h | 1 +
>  divelist.c    | 5 +++++
>  gtk-gui.c     | 2 ++
>  3 files changed, 8 insertions(+)
>
> diff --git a/display-gtk.h b/display-gtk.h
> index b755152..7b2ce5f 100644
> --- a/display-gtk.h
> +++ b/display-gtk.h
> @@ -74,6 +74,7 @@ extern GtkWidget *cylinder_list_widget(int w_idx);
>  extern GtkWidget *weightsystem_list_widget(int w_idx);
>  
>  extern GtkWidget *dive_list_create(void);
> +extern void dive_list_destroy(void);
>  
>  unsigned int amount_selected;
>  
> diff --git a/divelist.c b/divelist.c
> index 2d6c6fd..9bdee15 100644
> --- a/divelist.c
> +++ b/divelist.c
> @@ -2294,6 +2294,11 @@ GtkWidget *dive_list_create(void)
>  	return dive_list.container_widget;
>  }
>  
> +void dive_list_destroy(void)
> +{
> +	gtk_widget_destroy(dive_list.tree_view);
> +}
> +
>  void mark_divelist_changed(int changed)
>  {
>  	dive_list.changed = changed;
> diff --git a/gtk-gui.c b/gtk-gui.c
> index 0a4ee48..5a680c7 100644
> --- a/gtk-gui.c
> +++ b/gtk-gui.c
> @@ -356,6 +356,7 @@ static gboolean on_delete(GtkWidget* w, gpointer data)
>  
>  static void on_destroy(GtkWidget* w, gpointer data)
>  {
> +	dive_list_destroy();
>  	gtk_main_quit();
>  }
>  
> @@ -369,6 +370,7 @@ void quit(GtkWidget *w, gpointer data)
>  		quit = ask_save_changes();
>  
>  	if (quit){
> +		dive_list_destroy();
>  		gtk_main_quit();
>  	}
>  }
> -- 
> 1.7.11.msysgit.0


More information about the subsurface mailing list