diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c index cf6769ac9..d742c6bda 100644 --- a/src/st/st-theme-node.c +++ b/src/st/st-theme-node.c @@ -9,6 +9,7 @@ static void st_theme_node_init (StThemeNode *node); static void st_theme_node_class_init (StThemeNodeClass *klass); +static void st_theme_node_dispose (GObject *object); static void st_theme_node_finalize (GObject *object); static const ClutterColor BLACK_COLOR = { 0, 0, 0, 0xff }; @@ -27,9 +28,43 @@ st_theme_node_class_init (StThemeNodeClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->dispose = st_theme_node_dispose; object_class->finalize = st_theme_node_finalize; } + +static void +st_theme_node_dispose (GObject *gobject) +{ + StThemeNode *node = ST_THEME_NODE (gobject); + + if (node->context) + { + g_object_unref (node->context); + node->context = NULL; + } + + if (node->theme) + { + g_object_unref (node->theme); + node->theme = NULL; + } + + if (node->parent_node) + { + g_object_unref (node->parent_node); + node->parent_node = NULL; + } + + if (node->border_image) + { + g_object_unref (node->border_image); + node->border_image = NULL; + } + + G_OBJECT_CLASS (st_theme_node_parent_class)->dispose (gobject); +} + static void st_theme_node_finalize (GObject *object) { @@ -59,12 +94,6 @@ st_theme_node_finalize (GObject *object) node->font_desc = NULL; } - if (node->border_image) - { - g_object_unref (node->border_image); - node->border_image = NULL; - } - if (node->shadow) { st_shadow_free (node->shadow); diff --git a/src/st/st-widget.c b/src/st/st-widget.c index dba5a040e..75da099fc 100644 --- a/src/st/st-widget.c +++ b/src/st/st-widget.c @@ -253,6 +253,7 @@ st_widget_dispose (GObject *gobject) if (priv->theme_node) { + g_object_run_dispose (G_OBJECT (priv->theme_node)); g_object_unref (priv->theme_node); priv->theme_node = NULL; }