diff options
author | Owen Taylor <otaylor@redhat.com> | 2002-01-08 19:44:34 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2002-01-08 19:44:34 +0000 |
commit | fda8a3de957a3c6c362960f0904fdefc1cad8f68 (patch) | |
tree | 6335f07db55ee7e640601788149b27547a4be205 /gtk/gtktoolbar.c | |
parent | 07d4e54cc6f32421aae976bd797a9dd9943e0ada (diff) | |
download | gtk+-fda8a3de957a3c6c362960f0904fdefc1cad8f68.tar.gz |
Fix leaks of results of gtk_container_get_children(). (#68199, Damon
Tue Jan 8 14:42:19 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c: Fix leaks of results of
gtk_container_get_children(). (#68199, Damon Chaplin)
Diffstat (limited to 'gtk/gtktoolbar.c')
-rw-r--r-- | gtk/gtktoolbar.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 916f359a1e..9c9b3fe76c 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -1602,6 +1602,16 @@ gtk_real_toolbar_orientation_changed (GtkToolbar *toolbar, } } +static GtkWidget * +get_first_child (GtkContainer *container) +{ + GList *children = gtk_container_get_children (children); + GtkWidget *result = children ? children->data : NULL; + g_list_free (children); + + return result; +} + static void gtk_real_toolbar_style_changed (GtkToolbar *toolbar, GtkToolbarStyle style) @@ -1650,7 +1660,7 @@ gtk_real_toolbar_style_changed (GtkToolbar *toolbar, if (child->label && !GTK_WIDGET_VISIBLE (child->label)) gtk_widget_show (child->label); - box = (GtkWidget*)gtk_container_get_children (GTK_CONTAINER (child->widget))->data; + box = get_first_child (GTK_CONTAINER (child->widget)); if (GTK_IS_HBOX (box)) { @@ -1694,7 +1704,7 @@ gtk_real_toolbar_style_changed (GtkToolbar *toolbar, if (child->label && !GTK_WIDGET_VISIBLE (child->label)) gtk_widget_show (child->label); - box = (GtkWidget*)gtk_container_get_children (GTK_CONTAINER (child->widget))->data; + box = get_first_child (GTK_CONTAINER (child->widget)); if (GTK_IS_VBOX (box)) { |