mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 17:58:26 +02:00
mesa: Prevent repeated glDeleteShader() from blowing away our refcounts.
Calling glDeleteShader() should mark shaders as pending for deletion, but shouldn't decrement the refcount every time. Otherwise, repeated glDeleteShader() is not safe. This is particularly bad since glDeleteProgram() frees shaders: if you first call glDeleteShader() on the shaders attached to the program (thus decrementing the refcount), then called glDeleteProgram(), it would try to free them again (decrementing the refcount another time), causing a refcount > 0 assertion to fail. Similar to commitd950a778. NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Brian Paul <brianp@vmware.com> (cherry picked from commitc3bc41011f)
This commit is contained in:
parent
c33b752899
commit
f9aefaeb27
1 changed files with 5 additions and 3 deletions
|
|
@ -404,10 +404,12 @@ delete_shader(struct gl_context *ctx, GLuint shader)
|
|||
if (!sh)
|
||||
return;
|
||||
|
||||
sh->DeletePending = GL_TRUE;
|
||||
if (!sh->DeletePending) {
|
||||
sh->DeletePending = GL_TRUE;
|
||||
|
||||
/* effectively, decr sh's refcount */
|
||||
_mesa_reference_shader(ctx, &sh, NULL);
|
||||
/* effectively, decr sh's refcount */
|
||||
_mesa_reference_shader(ctx, &sh, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue