[gtk+/wip/cssvalue: 19/141] stylecontext: Keep track of children
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cssvalue: 19/141] stylecontext: Keep track of children
- Date: Sat, 7 Apr 2012 17:47:45 +0000 (UTC)
commit ec50f83e849849a8ba330cc2797bcc20c9a592ea
Author: Benjamin Otte <otte redhat com>
Date: Tue Mar 20 02:06:00 2012 +0100
stylecontext: Keep track of children
gtk/gtkstylecontext.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 4e8e282..6bbc6d6 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -361,6 +361,7 @@ struct _GtkStyleContextPrivate
GtkStyleCascade *cascade;
GtkStyleContext *parent;
+ GSList *children;
GtkWidget *widget;
GtkWidgetPath *widget_path;
GHashTable *style_data;
@@ -806,6 +807,9 @@ gtk_style_context_finalize (GObject *object)
style_context = GTK_STYLE_CONTEXT (object);
priv = style_context->priv;
+ /* children hold a reference to us */
+ g_assert (priv->children == NULL);
+
gtk_style_context_set_parent (style_context, NULL);
if (priv->widget_path)
@@ -1580,10 +1584,16 @@ gtk_style_context_set_parent (GtkStyleContext *context,
return;
if (parent)
- g_object_ref (parent);
+ {
+ parent->priv->children = g_slist_prepend (parent->priv->children, context);
+ g_object_ref (parent);
+ }
if (priv->parent)
- g_object_unref (priv->parent);
+ {
+ priv->parent->priv->children = g_slist_remove (priv->parent->priv->children, context);
+ g_object_unref (priv->parent);
+ }
priv->parent = parent;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]