[goffice] do not unrealize an item twice
- From: Jean Bréfort <jbrefort src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [goffice] do not unrealize an item twice
- Date: Thu, 27 Aug 2009 15:21:01 +0000 (UTC)
commit 166bb7ea85e3f7a338e4430b3a35b1ba2660313d
Author: Jean Brefort <jean brefort normalesup org>
Date: Thu Aug 27 17:20:35 2009 +0200
do not unrealize an item twice
ChangeLog | 7 +++++++
goffice/canvas/goc-group.c | 20 ++++++++++++++------
goffice/canvas/goc-item.c | 9 ++++++---
goffice/canvas/goc-item.h | 1 +
4 files changed, 28 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d7fc179..b808167 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-08-27 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/canvas/goc-group.c (goc_group_realize),
+ (goc_group_unrealize): don't unrealize an item several times.
+ * goffice/canvas/goc-item.c (goc_item_finalize): ditto.
+ * goffice/canvas/goc-item.h: ditto.
+
2009-08-26 Morten Welinder <terra gnome org>
* goffice/graph/Makefile.am: The ui file needs to be distributed
diff --git a/goffice/canvas/goc-group.c b/goffice/canvas/goc-group.c
index 3449e55..8a52e35 100644
--- a/goffice/canvas/goc-group.c
+++ b/goffice/canvas/goc-group.c
@@ -178,9 +178,13 @@ goc_group_realize (GocItem *item)
GList *l;
GocItemClass *klass;
for (l = g_list_first (group->children); l; l = g_list_next (l)) {
- klass = GOC_ITEM_GET_CLASS (l->data);
- if (klass->realize)
- klass->realize (GOC_ITEM (l->data));
+ GocItem *child = GOC_ITEM (l->data);
+ if (!child->realized) {
+ klass = GOC_ITEM_GET_CLASS (l->data);
+ if (klass->realize)
+ klass->realize (GOC_ITEM (l->data));
+ item->realized = TRUE;
+ }
}
}
@@ -191,9 +195,13 @@ goc_group_unrealize (GocItem *item)
GList *l;
GocItemClass *klass;
for (l = g_list_first (group->children); l; l = g_list_next (l)) {
- klass = GOC_ITEM_GET_CLASS (l->data);
- if (klass->unrealize)
- klass->unrealize (GOC_ITEM (l->data));
+ GocItem *child = GOC_ITEM (l->data);
+ if (child->realized) {
+ klass = GOC_ITEM_GET_CLASS (child);
+ if (klass->unrealize)
+ klass->unrealize (child);
+ item->realized = FALSE;
+ }
}
}
diff --git a/goffice/canvas/goc-item.c b/goffice/canvas/goc-item.c
index 3c5dbf3..fafb716 100644
--- a/goffice/canvas/goc-item.c
+++ b/goffice/canvas/goc-item.c
@@ -82,9 +82,12 @@ goc_item_finalize (GObject *object)
if (item->canvas->last_item == item)
item->canvas->last_item = NULL;
if (GTK_WIDGET_REALIZED (item->canvas)) {
- GocItemClass *klass = GOC_ITEM_GET_CLASS (item);
- if (klass->unrealize)
- klass->unrealize (item);
+ if (item->realized) {
+ GocItemClass *klass = GOC_ITEM_GET_CLASS (item);
+ if (klass->unrealize)
+ klass->unrealize (item);
+ item->realized = FALSE;
+ }
item->cached_bounds = TRUE; /* avois a call to update_bounds */
goc_item_invalidate (item);
}
diff --git a/goffice/canvas/goc-item.h b/goffice/canvas/goc-item.h
index 4447301..4ddbbf9 100644
--- a/goffice/canvas/goc-item.h
+++ b/goffice/canvas/goc-item.h
@@ -34,6 +34,7 @@ struct _GocItem {
gboolean cached_bounds;
gboolean needs_redraw;
gboolean visible;
+ gboolean realized;
double x0, y0, x1, y1; /* the bounds */
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]