Ref the RC style that is passed in. The lack of the ref before was a bug.
Sun Sep 5 08:48:51 1999 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c (gtk_widget_modify_style): Ref the RC style that is passed in. The lack of the ref before was a bug. If people worked around this bug, this will introduce a slight memory leak in their code. The code should typically look like: rc_style = gtk_rc_style_new (); [...] gtk_widget_modify_style (widget, rc_style); gtk_rc_style_unref (rc_style); * gtk/gtkwidget.c (gtk_widget_modify_style): Reset the style if it was already set. * gtk/gtkwidget.c (gtk_widget_set_name): Only set the style if it was set before.
This commit is contained in:
@@ -3175,7 +3175,7 @@ gtk_widget_set_name (GtkWidget *widget,
|
||||
g_free (widget->name);
|
||||
widget->name = g_strdup (name);
|
||||
|
||||
if (!GTK_WIDGET_USER_STYLE (widget))
|
||||
if (GTK_WIDGET_RC_STYLE (widget))
|
||||
gtk_widget_set_rc_style (widget);
|
||||
}
|
||||
|
||||
@@ -3480,10 +3480,17 @@ gtk_widget_modify_style (GtkWidget *widget,
|
||||
old_style = gtk_object_get_data_by_id (GTK_OBJECT (widget), rc_style_key_id);
|
||||
|
||||
if (style != old_style)
|
||||
gtk_object_set_data_by_id_full (GTK_OBJECT (widget),
|
||||
rc_style_key_id,
|
||||
style,
|
||||
(GtkDestroyNotify)gtk_rc_style_unref);
|
||||
{
|
||||
gtk_rc_style_ref (style);
|
||||
|
||||
gtk_object_set_data_by_id_full (GTK_OBJECT (widget),
|
||||
rc_style_key_id,
|
||||
style,
|
||||
(GtkDestroyNotify)gtk_rc_style_unref);
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_RC_STYLE (widget))
|
||||
gtk_widget_set_rc_style (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user