[glade/composite-templates-new: 1/9] GladeWidget: Remove children when disposing
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/composite-templates-new: 1/9] GladeWidget: Remove children when disposing
- Date: Fri, 5 Apr 2013 06:19:14 +0000 (UTC)
commit 22a7e2a3ec7e541de6b743b75c08190e46379590
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Fri Apr 5 15:10:46 2013 +0900
GladeWidget: Remove children when disposing
Normally this doesnt happen because GladeProject breaks
hierarchy before disposing, here we ensure proper breaking
of reference cycles for the sake of good API (so we can write
proper tests).
gladeui/glade-widget.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 33bd9b0..4692532 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -978,9 +978,21 @@ static void
glade_widget_dispose (GObject * object)
{
GladeWidget *widget = GLADE_WIDGET (object);
+ GList *children, *l;
glade_widget_push_superuser ();
+ /* Remove all children at dispose */
+ children = glade_widget_get_children (widget);
+ for (l = children; l; l = l->next)
+ {
+ GladeWidget *child = glade_widget_get_from_gobject (l->data);
+
+ if (glade_widget_get_internal (child) == NULL)
+ glade_widget_remove_child (widget, child);
+ }
+ g_list_free (children);
+
/* Release references by way of object properties... */
while (widget->priv->prop_refs)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]