From 8019714b5d00ca6c820942bb9d242b189d344e14 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 9 Aug 2022 09:30:16 +0000 Subject: [PATCH] texture-mipmap: Fix some leaks and tidy up Seems we were leaking mipmap->mipmap_texture and mipmap->fb. Part-of: --- 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 c28b8cbb2..177704b97 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;