From 5af2f825c39cd4c242f5469ad7075bb0d0455a2d Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Tue, 6 Apr 2004 01:23:26 +0000 Subject: [PATCH] Ref/sink the buttons. Also, free them correctly upon failure. Based on a 2004-04-05 Federico Mena Quintero * gtk/gtkpathbar.c (_gtk_path_bar_set_path): Ref/sink the buttons. Also, free them correctly upon failure. Based on a patch by Morten Welinder, fixes #137956. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtkpathbar.c | 12 +++++++++--- 6 files changed, 39 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c5eeb00280..74d96dcb43 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-04-05 Federico Mena Quintero + + * gtk/gtkpathbar.c (_gtk_path_bar_set_path): Ref/sink the + buttons. Also, free them correctly upon failure. Based on a + patch by Morten Welinder, fixes #137956. + 2004-04-05 Anders Carlsson * gdk/gdk.c (gdk_arg_context_parse): Handle '--' correctly. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index c5eeb00280..74d96dcb43 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2004-04-05 Federico Mena Quintero + + * gtk/gtkpathbar.c (_gtk_path_bar_set_path): Ref/sink the + buttons. Also, free them correctly upon failure. Based on a + patch by Morten Welinder, fixes #137956. + 2004-04-05 Anders Carlsson * gdk/gdk.c (gdk_arg_context_parse): Handle '--' correctly. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index c5eeb00280..74d96dcb43 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +2004-04-05 Federico Mena Quintero + + * gtk/gtkpathbar.c (_gtk_path_bar_set_path): Ref/sink the + buttons. Also, free them correctly upon failure. Based on a + patch by Morten Welinder, fixes #137956. + 2004-04-05 Anders Carlsson * gdk/gdk.c (gdk_arg_context_parse): Handle '--' correctly. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index c5eeb00280..74d96dcb43 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +2004-04-05 Federico Mena Quintero + + * gtk/gtkpathbar.c (_gtk_path_bar_set_path): Ref/sink the + buttons. Also, free them correctly upon failure. Based on a + patch by Morten Welinder, fixes #137956. + 2004-04-05 Anders Carlsson * gdk/gdk.c (gdk_arg_context_parse): Handle '--' correctly. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index c5eeb00280..74d96dcb43 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +2004-04-05 Federico Mena Quintero + + * gtk/gtkpathbar.c (_gtk_path_bar_set_path): Ref/sink the + buttons. Also, free them correctly upon failure. Based on a + patch by Morten Welinder, fixes #137956. + 2004-04-05 Anders Carlsson * gdk/gdk.c (gdk_arg_context_parse): Handle '--' correctly. diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index 4a04dbacda..c2139c13c1 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -1058,6 +1058,9 @@ _gtk_path_bar_set_path (GtkPathBar *path_bar, gtk_file_info_free (file_info); gtk_file_path_free (path); + g_object_ref (button_data->button); + gtk_object_sink (GTK_OBJECT (button_data->button)); + new_buttons = g_list_prepend (new_buttons, button_data); if (button_data->type != NORMAL_BUTTON) @@ -1089,9 +1092,12 @@ _gtk_path_bar_set_path (GtkPathBar *path_bar, for (l = new_buttons; l; l = l->next) { - GtkWidget *button = BUTTON_DATA (l->data)->button; - gtk_widget_destroy (button); - gtk_widget_unref (button); + ButtonData *button_data; + + button_data = BUTTON_DATA (l->data); + + gtk_widget_unref (button_data->button); + button_data_free (button_data); } g_list_free (new_buttons);