[goffice] fixed canvas widget item life cycle



commit 3fb643092c03eea62f9d4edaa55e241c460be56a
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sat Sep 12 10:25:16 2009 +0200

    fixed canvas widget item life cycle

 ChangeLog                   |    5 +++++
 goffice/canvas/goc-widget.c |    5 ++---
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8486588..d136a8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-12  Jean Brefort  <jean brefort normalesup org>
+
+	* goffice/canvas/goc-widget.c (goc_widget_set_property): don't destroy
+	the old widget, just remove it from the canvas.
+
 2009-09-11  Jean Brefort  <jean brefort normalesup org>
 
 	* docs/reference/goffice-sections.txt: make things work again after
diff --git a/goffice/canvas/goc-widget.c b/goffice/canvas/goc-widget.c
index 5076fa3..af105d0 100644
--- a/goffice/canvas/goc-widget.c
+++ b/goffice/canvas/goc-widget.c
@@ -103,9 +103,8 @@ goc_widget_set_property (GObject *obj, guint param_id,
 		GtkWidget *widget = GTK_WIDGET (g_value_get_object (value));
 		if (widget == item->widget)
 			return;
-		if (item->widget) {
-			gtk_widget_destroy (item->widget);
-		}
+		if (item->widget)
+			gtk_container_remove (GTK_CONTAINER (item->base.canvas), item->widget);
 		item->widget = widget;
 		gtk_widget_show (widget);
 		gtk_layout_put (GTK_LAYOUT (GOC_ITEM (item)->canvas), widget, item->x, item->y);



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