[grisbi-devel] [PATCH 02/15] Fix double-free crash in gsb_file_close()

Rémi Cardona remi at gentoo.org
Sat Mar 9 16:53:54 CET 2013


The 'vbox_general' is already freed when its parent widget is destroyed.
So not only is this code useless, it's broken.
---
 src/fenetre_principale.c | 20 ++------------------
 src/fenetre_principale.h |  1 -
 src/gsb_file.c           |  1 -
 3 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/src/fenetre_principale.c b/src/fenetre_principale.c
index 79f00d4..fd8fcbc 100644
--- a/src/fenetre_principale.c
+++ b/src/fenetre_principale.c
@@ -71,7 +71,6 @@ static gboolean on_simpleclick_event_run ( GtkWidget * button, GdkEvent * button
 
 
 /* données des widgets généraux */
-static GtkWidget *vbox_general = NULL;
 static GtkWidget *notebook_general = NULL;
 
 /** Notebook of the account pane. */
@@ -93,7 +92,7 @@ static GtkWidget * headings_suffix = NULL;
  */
 GtkWidget *gsb_gui_create_general_widgets ( void )
 {
-    GtkWidget *hpaned_general;
+    GtkWidget *hpaned_general, *vbox_general;
     GtkWidget * hbox, * arrow_eb, * arrow_left, * arrow_right;
     GtkStyle * style;
 
@@ -505,22 +504,7 @@ gboolean gsb_gui_hpaned_size_allocate ( GtkWidget *hpaned,
 
 
 /**
- * initialise notebook_general et vbox_general
- *
- *
- */
-void gsb_gui_init_general_vbox ( void )
-{
-    if ( vbox_general )
-    {
-        gtk_widget_destroy ( vbox_general );
-        vbox_general = NULL;
-    }
-}
-
-
-/**
- * initialise notebook_general et vbox_general
+ * initialise notebook_general
  *
  *
  */
diff --git a/src/fenetre_principale.h b/src/fenetre_principale.h
index 74d4fa4..e6e4990 100644
--- a/src/fenetre_principale.h
+++ b/src/fenetre_principale.h
@@ -34,7 +34,6 @@ GtkWidget *gsb_gui_get_general_notebook (void );
 void gsb_gui_headings_update_suffix ( gchar * suffix );
 void gsb_gui_headings_update_title ( gchar * title );
 void gsb_gui_init_general_notebook ( void );
-void gsb_gui_init_general_vbox ( void );
 gint gsb_gui_get_hpaned_left_width ( void );
 void gsb_gui_notebook_change_page ( GsbGeneralNotebookPages page );
 void gsb_gui_on_account_change_page ( GsbAccountNotebookPages page );
diff --git a/src/gsb_file.c b/src/gsb_file.c
index 6abe99c..e3142dd 100644
--- a/src/gsb_file.c
+++ b/src/gsb_file.c
@@ -970,7 +970,6 @@ gboolean gsb_file_close ( void )
 		 &&
 		 nom_fichier_comptes )
 		gsb_file_util_modify_lock ( FALSE );
-        gsb_gui_init_general_vbox ( );
 
 	    /* free all the variables */
  	    init_variables ();
-- 
1.8.1.4



More information about the devel mailing list