summaryrefslogtreecommitdiff
path: root/gtk/gtkbutton.c
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2003-11-07 21:57:20 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2003-11-07 21:57:20 +0000
commit96fb3e88328b3c268c503818e6fa8a7c210277c5 (patch)
treea95ee7f247bed4c5cc9ebaa05c4dc90b4a0b4259 /gtk/gtkbutton.c
parent1ed2fe4a640d876b2857411ee40679156790c992 (diff)
downloadgdk-pixbuf-96fb3e88328b3c268c503818e6fa8a7c210277c5.tar.gz
Make string setters safe for self-assignment. (#122745, Soeren Sandmann)
Fri Nov 7 22:55:49 2003 Matthias Clasen <maclas@gmx.de> * gtk/gtkwindow.c (gtk_window_set_role): * gtk/gtkwindow.c (gtk_window_set_title): * gtk/gtkwidget.c (gtk_widget_set_name): * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_title): * gtk/gtkbutton.c (gtk_button_set_label): Make string setters safe for self-assignment. (#122745, Soeren Sandmann)
Diffstat (limited to 'gtk/gtkbutton.c')
-rw-r--r--gtk/gtkbutton.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index ba8ffee66..ae80e4a8d 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -1133,10 +1133,13 @@ void
gtk_button_set_label (GtkButton *button,
const gchar *label)
{
- g_return_if_fail (GTK_IS_BUTTON (button));
+ gchar *new_label;
+ g_return_if_fail (GTK_IS_BUTTON (button));
+
+ new_label = g_strdup (label);
g_free (button->label_text);
- button->label_text = g_strdup (label);
+ button->label_text = new_label;
gtk_button_construct_child (button);