clutter/actor: Unref the root node if set as child

When setting the root node as child of a clip or transform node, we add a
new reference to it, without removing the one that we've previously added
when getting it from the actor node (and that won't ever be unset by the
auto-pointer since the root_node is re-associated).

So, once we add the root node as child and re-define it, unref it.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/908
This commit is contained in:
Marco Trevisan (Treviño) 2019-11-04 12:51:43 +01:00 committed by Carlos Garnacho
parent 60800d2313
commit f133de2dd4

View File

@ -3934,6 +3934,7 @@ clutter_actor_paint (ClutterActor *self)
clip_node = clutter_clip_node_new (); clip_node = clutter_clip_node_new ();
clutter_paint_node_add_rectangle (clip_node, &clip); clutter_paint_node_add_rectangle (clip_node, &clip);
clutter_paint_node_add_child (clip_node, root_node); clutter_paint_node_add_child (clip_node, root_node);
clutter_paint_node_unref (root_node);
root_node = g_steal_pointer (&clip_node); root_node = g_steal_pointer (&clip_node);
} }
@ -3947,6 +3948,7 @@ clutter_actor_paint (ClutterActor *self)
transform_node = clutter_transform_node_new (&transform); transform_node = clutter_transform_node_new (&transform);
clutter_paint_node_add_child (transform_node, root_node); clutter_paint_node_add_child (transform_node, root_node);
clutter_paint_node_unref (root_node);
root_node = g_steal_pointer (&transform_node); root_node = g_steal_pointer (&transform_node);