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)
This commit is contained in:
Matthias Clasen 2003-11-07 21:57:20 +00:00 committed by Matthias Clasen
parent 1ed2fe4a64
commit 96fb3e8832
9 changed files with 69 additions and 17 deletions

View File

@ -1,3 +1,12 @@
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)
Thu Nov 6 20:41:40 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkstyle.c (gtk_style_attach): Fix doc comment.

View File

@ -1,3 +1,12 @@
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)
Thu Nov 6 20:41:40 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkstyle.c (gtk_style_attach): Fix doc comment.

View File

@ -1,3 +1,12 @@
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)
Thu Nov 6 20:41:40 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkstyle.c (gtk_style_attach): Fix doc comment.

View File

@ -1,3 +1,12 @@
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)
Thu Nov 6 20:41:40 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkstyle.c (gtk_style_attach): Fix doc comment.

View File

@ -1,3 +1,12 @@
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)
Thu Nov 6 20:41:40 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkstyle.c (gtk_style_attach): Fix doc comment.

View File

@ -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);

View File

@ -2024,13 +2024,13 @@ void
gtk_tree_view_column_set_title (GtkTreeViewColumn *tree_column,
const gchar *title)
{
gchar *new_title;
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
new_title = g_strdup (title);
g_free (tree_column->title);
if (title)
tree_column->title = g_strdup (title);
else
tree_column->title = NULL;
tree_column->title = new_title;
gtk_tree_view_column_update_button (tree_column);
g_object_notify (G_OBJECT (tree_column), "title");

View File

@ -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);

View File

@ -987,11 +987,13 @@ void
gtk_window_set_title (GtkWindow *window,
const gchar *title)
{
char *new_title;
g_return_if_fail (GTK_IS_WINDOW (window));
if (window->title)
g_free (window->title);
window->title = g_strdup (title);
new_title = g_strdup (title);
g_free (window->title);
window->title = new_title;
if (GTK_WIDGET_REALIZED (window))
{
@ -1077,13 +1079,13 @@ void
gtk_window_set_role (GtkWindow *window,
const gchar *role)
{
char *new_role;
g_return_if_fail (GTK_IS_WINDOW (window));
if (role == window->wm_role)
return;
new_role = g_strdup (role);
g_free (window->wm_role);
window->wm_role = g_strdup (role);
window->wm_role = new_role;
if (GTK_WIDGET_REALIZED (window))
gdk_window_set_role (GTK_WIDGET (window)->window, window->wm_role);