[gthumb] fixed crash when destroying the widget



commit afabd8201c9f68ca605a75c40d07defdba0f9418
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Nov 16 22:58:08 2011 +0100

    fixed crash when destroying the widget

 gthumb/gth-dumb-notebook.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gthumb/gth-dumb-notebook.c b/gthumb/gth-dumb-notebook.c
index ce9a34e..d435964 100644
--- a/gthumb/gth-dumb-notebook.c
+++ b/gthumb/gth-dumb-notebook.c
@@ -245,12 +245,16 @@ gth_dumb_notebook_remove (GtkContainer *container,
 	if (g_list_find (notebook->priv->children, child) == NULL)
 		return;
 
-	gtk_widget_freeze_child_notify (child);
+	g_object_ref (child);
+	gtk_widget_unparent (child);
 
-	notebook->priv->children = g_list_remove (notebook->priv->children, child);
+	/* do not modify the children list during destruction otherwise
+	 * gtk_container_forall doesn't work correctly. */
+	if (! gtk_widget_in_destruction (GTK_WIDGET (container)))
+		notebook->priv->children = g_list_remove (notebook->priv->children, child);
 	notebook->priv->n_children--;
 
-	gtk_widget_thaw_child_notify (child);
+	g_object_unref (child);
 }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]