[goffice] Canvas: add sanity check to group disposal.



commit 91e9966704d5f22fba0ddebb8e1c3850860d3fb5
Author: Morten Welinder <terra gnome org>
Date:   Wed Sep 16 10:20:38 2009 -0400

    Canvas: add sanity check to group disposal.

 ChangeLog                  |    4 ++++
 goffice/canvas/goc-group.c |   14 +++++++++++++-
 2 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c65d8ee..40caf23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-09-15  Morten Welinder  <terra gnome org>
+
+	* goffice/canvas/goc-group.c (goc_group_clear): Add sanity check.
+
 2009-09-14  Morten Welinder  <terra gnome org>
 
 	* goffice/canvas/goc-widget.c (goc_widget_set_widget): Split from
diff --git a/goffice/canvas/goc-group.c b/goffice/canvas/goc-group.c
index 0b0bf2d..6a45c02 100644
--- a/goffice/canvas/goc-group.c
+++ b/goffice/canvas/goc-group.c
@@ -280,8 +280,20 @@ goc_group_clear (GocGroup *group)
 {
 	g_return_if_fail (GOC_IS_GROUP (group));
 	while (group->children != NULL) {
-		GocItem *child = group->children->data;
+		GList *this = group->children;
+		GList *next = this->next;
+		GocItem *child = this->data;
 		goc_item_destroy (child);
+		if (group->children != next) {
+			/* The most likely trigger of this is a dispose
+			   method that doesn't chain up to the parent
+			   class' dispose.  */
+			g_warning ("Trouble clearing child %p from group %p\n",
+				   child,
+				   group);
+			if (group->children == this)
+				group->children = next;
+		}
 	}
 }
 



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