diff options
author | Matthias Clasen <maclas@gmx.de> | 2003-11-07 21:57:20 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2003-11-07 21:57:20 +0000 |
commit | 96fb3e88328b3c268c503818e6fa8a7c210277c5 (patch) | |
tree | a95ee7f247bed4c5cc9ebaa05c4dc90b4a0b4259 /gtk/gtkwidget.c | |
parent | 1ed2fe4a640d876b2857411ee40679156790c992 (diff) | |
download | gtk+-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/gtkwidget.c')
-rw-r--r-- | gtk/gtkwidget.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 7edaa57157..98b7c5c48a 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -3929,11 +3929,13 @@ void gtk_widget_set_name (GtkWidget *widget, const gchar *name) { - g_return_if_fail (GTK_IS_WIDGET (widget)); + gchar *new_name; - if (widget->name) - g_free (widget->name); - widget->name = g_strdup (name); + g_return_if_fail (GTK_IS_WIDGET (widget)); + + new_name = g_strdup (name); + g_free (widget->name); + widget->name = new_name; if (GTK_WIDGET_RC_STYLE (widget)) gtk_widget_reset_rc_style (widget); |