diff options
author | Xiang, Haihao <[email protected]> | 2008-03-31 17:02:47 +0800 |
---|---|---|
committer | Xiang, Haihao <[email protected]> | 2008-03-31 17:17:34 +0800 |
commit | 63d8a8417d68365cd10c11178516378411c09f87 (patch) | |
tree | 5c3fb18383b153be5b17b1f8f2c461c218ee1318 /src/mesa/main | |
parent | aef47c4dc87075fd63002b50c4b32b1049e5e4d1 (diff) |
mesa: Free all shader program data before deleting all
shader/shader program objects to avoid memory access error.
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/context.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 087e18fb53e..d94876e70bd 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -623,6 +623,21 @@ delete_arrayobj_cb(GLuint id, void *data, void *userData) } /** + * Callback for freeing shader program data. Call it before delete_shader_cb + * to avoid memory access error. + */ +static void +free_shader_program_data_cb(GLuint id, void *data, void *userData) +{ + GLcontext *ctx = (GLcontext *) userData; + struct gl_shader_program *shProg = (struct gl_shader_program *) data; + + if (shProg->Type == GL_SHADER_PROGRAM_MESA) { + _mesa_free_shader_program_data(ctx, shProg); + } +} + +/** * Callback for deleting shader and shader programs objects. * Called by _mesa_HashDeleteAll(). */ @@ -721,6 +736,7 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_DeleteHashTable(ss->ArrayObjects); #if FEATURE_ARB_shader_objects + _mesa_HashWalk(ss->ShaderObjects, free_shader_program_data_cb, ctx); _mesa_HashDeleteAll(ss->ShaderObjects, delete_shader_cb, ctx); _mesa_DeleteHashTable(ss->ShaderObjects); #endif |