Fixed double-free in the shader cache at shutdown
This commit is contained in:
parent
a5bb3d3f60
commit
0a82b3eefe
1 changed files with 23 additions and 13 deletions
|
@ -190,24 +190,34 @@ static void
|
||||||
GLES2_DestroyRenderer(SDL_Renderer *renderer)
|
GLES2_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata;
|
GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata;
|
||||||
GLES2_ProgramCacheEntry *entry;
|
|
||||||
GLES2_ProgramCacheEntry *next;
|
|
||||||
|
|
||||||
/* Deallocate everything */
|
/* Deallocate everything */
|
||||||
if (rdata) {
|
if (rdata) {
|
||||||
GLES2_ActivateRenderer(renderer);
|
GLES2_ActivateRenderer(renderer);
|
||||||
|
|
||||||
entry = rdata->program_cache.head;
|
{
|
||||||
while (entry) {
|
GLES2_ShaderCacheEntry *entry;
|
||||||
glDeleteShader(entry->vertex_shader->id);
|
GLES2_ShaderCacheEntry *next;
|
||||||
glDeleteShader(entry->fragment_shader->id);
|
entry = rdata->shader_cache.head;
|
||||||
SDL_free(entry->vertex_shader);
|
while (entry)
|
||||||
SDL_free(entry->fragment_shader);
|
{
|
||||||
glDeleteProgram(entry->id);
|
glDeleteShader(entry->id);
|
||||||
next = entry->next;
|
next = entry->next;
|
||||||
SDL_free(entry);
|
SDL_free(entry);
|
||||||
entry = next;
|
entry = next;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
GLES2_ProgramCacheEntry *entry;
|
||||||
|
GLES2_ProgramCacheEntry *next;
|
||||||
|
entry = rdata->program_cache.head;
|
||||||
|
while (entry) {
|
||||||
|
glDeleteProgram(entry->id);
|
||||||
|
next = entry->next;
|
||||||
|
SDL_free(entry);
|
||||||
|
entry = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (rdata->context) {
|
if (rdata->context) {
|
||||||
SDL_GL_DeleteContext(rdata->context);
|
SDL_GL_DeleteContext(rdata->context);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue