[gtk/wip/baedert/for-master: 11/23] GskTransform: Avoid a ref+unref pair




commit bd5d1615ac53fb2339147cc99c26f6da5613538c
Author: Timm Bäder <mail baedert org>
Date:   Fri Dec 18 10:10:56 2020 +0100

    GskTransform: Avoid a ref+unref pair
    
    If gsk_transform_is_identity() returned FALSE for the next transform,
    the previous code did a ref + unref pair, even though it was unneeded.

 gsk/gsktransform.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gsktransform.c b/gsk/gsktransform.c
index adc64ccc30..3f1e89ad43 100644
--- a/gsk/gsktransform.c
+++ b/gsk/gsktransform.c
@@ -127,8 +127,10 @@ gsk_transform_alloc (const GskTransformClass *transform_class,
 
   self->transform_class = transform_class;
   self->category = next ? MIN (category, next->category) : category;
-  self->next = gsk_transform_is_identity (next) ? NULL : gsk_transform_ref (next);
-  g_clear_pointer (&next, gsk_transform_unref);
+  if (gsk_transform_is_identity (next))
+    gsk_transform_unref (next);
+  else
+    self->next = next;
 
   return self;
 }


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