summaryrefslogtreecommitdiff
path: root/gtk/gtktoolbar.c
diff options
context:
space:
mode:
authorTim Janik <timj@gimp.org>1998-02-02 20:40:03 +0000
committerTim Janik <timj@src.gnome.org>1998-02-02 20:40:03 +0000
commit6b5e983f3d79e47b1a5fed716cdd05e7a4f5e717 (patch)
treec2fe54fd6c14913119ea5fabb9fba688a4cb323d /gtk/gtktoolbar.c
parenteeaefdf04fd1972f1c9bcd98997f940efe372d83 (diff)
downloadgtk+-6b5e983f3d79e47b1a5fed716cdd05e7a4f5e717.tar.gz
fixed destroy handler, so it doesn't segfault with the new refcounting
Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org> * gtk/gtktoolbar.c: fixed destroy handler, so it doesn't segfault with the new refcounting scheme anymore. * gtk/gtkhandlebox.c: * gtk/gtkclist.c: * gtk/gtkentry.c: * gtk/gtkrange.c: * gtk/gtktext.c: * gtk/gtkviewport.c: enforced gdk_window_set_user_data (window, NULL); gdk_window_destroy (window); window = NULL; throughout the code.
Diffstat (limited to 'gtk/gtktoolbar.c')
-rw-r--r--gtk/gtktoolbar.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 11c664a87b..d6823f34e4 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -182,7 +182,6 @@ gtk_toolbar_destroy (GtkObject *object)
{
GtkToolbar *toolbar;
GList *children;
- GtkToolbarChild *child;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_TOOLBAR (object));
@@ -190,23 +189,28 @@ gtk_toolbar_destroy (GtkObject *object)
toolbar = GTK_TOOLBAR (object);
gtk_object_unref (GTK_OBJECT (toolbar->tooltips));
+ toolbar->tooltips = NULL;
for (children = toolbar->children; children; children = children->next)
{
+ GtkToolbarChild *child;
+
child = children->data;
if (child->type != GTK_TOOLBAR_CHILD_SPACE)
{
- child->widget->parent = NULL;
- gtk_object_unref (GTK_OBJECT (child->widget));
+ gtk_widget_ref (child->widget);
+ gtk_widget_unparent (child->widget);
gtk_widget_destroy (child->widget);
+ gtk_widget_unref (child->widget);
}
g_free (child);
}
g_list_free (toolbar->children);
-
+ toolbar->children = NULL;
+
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
@@ -515,6 +519,9 @@ gtk_toolbar_remove (GtkContainer *container,
if ((child->type != GTK_TOOLBAR_CHILD_SPACE) && (child->widget == widget))
{
+ gboolean was_visible;
+
+ was_visible = GTK_WIDGET_VISIBLE (widget);
gtk_widget_unparent (widget);
toolbar->children = g_list_remove_link (toolbar->children, children);
@@ -522,7 +529,7 @@ gtk_toolbar_remove (GtkContainer *container,
g_list_free (children);
toolbar->num_children--;
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
+ if (was_visible && GTK_WIDGET_VISIBLE (container))
gtk_widget_queue_resize (GTK_WIDGET (container));
break;
@@ -643,7 +650,6 @@ gtk_toolbar_insert_item (GtkToolbar *toolbar,
if (child->label)
gtk_widget_show (child->label);
-
break;
default: