[mutter] texture-mipmap: Fix some leaks and tidy up



commit 8019714b5d00ca6c820942bb9d242b189d344e14
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Tue Aug 9 09:30:16 2022 +0000

    texture-mipmap: Fix some leaks and tidy up
    
    Seems we were leaking mipmap->mipmap_texture and mipmap->fb.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2562>

 src/compositor/meta-texture-mipmap.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/src/compositor/meta-texture-mipmap.c b/src/compositor/meta-texture-mipmap.c
index c28b8cbb24..177704b97f 100644
--- a/src/compositor/meta-texture-mipmap.c
+++ b/src/compositor/meta-texture-mipmap.c
@@ -68,8 +68,9 @@ meta_texture_mipmap_free (MetaTextureMipmap *mipmap)
   g_return_if_fail (mipmap != NULL);
 
   cogl_clear_object (&mipmap->pipeline);
-
-  meta_texture_mipmap_set_base_texture (mipmap, NULL);
+  cogl_clear_object (&mipmap->base_texture);
+  cogl_clear_object (&mipmap->mipmap_texture);
+  g_clear_object (&mipmap->fb);
 
   g_free (mipmap);
 }
@@ -86,17 +87,14 @@ meta_texture_mipmap_free (MetaTextureMipmap *mipmap)
  */
 void
 meta_texture_mipmap_set_base_texture (MetaTextureMipmap *mipmap,
-                                      CoglTexture      *texture)
+                                      CoglTexture       *texture)
 {
   g_return_if_fail (mipmap != NULL);
 
   if (texture == mipmap->base_texture)
     return;
 
-  if (mipmap->base_texture != NULL)
-    {
-      cogl_object_unref (mipmap->base_texture);
-    }
+  cogl_clear_object (&mipmap->base_texture);
 
   mipmap->base_texture = texture;
 


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