cogl: Unconditionally free pipeline shader/program state cache struct

destroy_shader_state()/destroy_program_state() are called when the qdata
pointer to the state cache structure gets overwritten, but were only
conditionally destroying it. This lead to leaks when called with a
shader/program state ref count > 1.

Fixes: 9b9e12edb ("cogl: Port Node/Pipeline/PipelineLayer away from CoglObject")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3141
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3366>
This commit is contained in:
Sebastian Keller 2023-11-06 21:18:30 +01:00 committed by Marge Bot
parent 145cac3a37
commit 61de313198
3 changed files with 6 additions and 3 deletions

View File

@ -164,8 +164,9 @@ destroy_shader_state (void *user_data)
g_free (shader_state->unit_state);
g_free (shader_state);
g_free (cache);
}
g_free (cache);
}
static void

View File

@ -298,8 +298,9 @@ destroy_program_state (void *user_data)
g_array_free (program_state->uniform_locations, TRUE);
g_free (program_state);
g_free (cache);
}
g_free (cache);
}
static void

View File

@ -121,8 +121,9 @@ destroy_shader_state (void *user_data)
GE( ctx, glDeleteShader (shader_state->gl_shader) );
g_free (shader_state);
g_free (cache);
}
g_free (cache);
}
static void