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>
This commit is contained in:
Daniel van Vugt 2022-08-09 09:30:16 +00:00 committed by Marge Bot
parent 8fcee7a8a5
commit 8019714b5d

View File

@ -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;