[mutter/gbsneto/layer-node-cleanups: 4/6] clutter/layer-node: Trivial code cleanup



commit e3aa6e1687ccc720ac42675293523e03f19fc7d7
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Mar 30 21:46:30 2020 -0300

    clutter/layer-node: Trivial code cleanup
    
    Both the valid and the error code paths end up unreffing
    the texture. Move the unref to the shared code path.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1167

 clutter/clutter/clutter-paint-nodes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter/clutter-paint-nodes.c b/clutter/clutter/clutter-paint-nodes.c
index 5a705dad4..bb9b79a9f 100644
--- a/clutter/clutter/clutter-paint-nodes.c
+++ b/clutter/clutter/clutter-paint-nodes.c
@@ -1444,7 +1444,6 @@ clutter_layer_node_new (const CoglMatrix        *projection,
   if (res->offscreen == NULL)
     {
       g_critical ("%s: Unable to create an offscreen buffer", G_STRLOC);
-      g_clear_pointer (&texture, cogl_object_unref);
       goto out;
     }
 
@@ -1460,8 +1459,9 @@ clutter_layer_node_new (const CoglMatrix        *projection,
                                    COGL_PIPELINE_FILTER_NEAREST);
   cogl_pipeline_set_layer_texture (res->pipeline, 0, texture);
   cogl_pipeline_set_color (res->pipeline, &color);
-  cogl_object_unref (texture);
 
 out:
+  g_clear_pointer (&texture, cogl_object_unref);
+
   return (ClutterPaintNode *) res;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]