diff options
author | Marek Olšák <[email protected]> | 2013-04-24 01:29:26 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-05-01 20:08:53 +0200 |
commit | 8eef6ad2e2f90feac231a2e09ed4765f23ed1557 (patch) | |
tree | 36bdf18ebe5d9152e92f406fe1dc4bf00192bc39 /src/mesa/vbo/vbo_exec_array.c | |
parent | b5b6460c40e1c46f6af6a490485132ea0864572c (diff) |
vbo: fix possible use-after-free segfault after a VAO is deleted
This like the fifth attempt to fix the issue.
Also with the new "validating" flag, we can set recalculate_inputs to FALSE
earlier in vbo_bind_arrays, because _mesa_update_state won't change it.
NOTE: This is a candidate for the stable branches.
v2: fixed a typo
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/vbo/vbo_exec_array.c')
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 7e61f7b31fd..1bf3af47b8b 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -501,6 +501,7 @@ vbo_bind_arrays(struct gl_context *ctx) if (exec->array.recalculate_inputs) { recalculate_input_bindings(ctx); + exec->array.recalculate_inputs = GL_FALSE; /* Again... because we may have changed the bitmask of per-vertex varying * attributes. If we regenerate the fixed-function vertex program now @@ -508,10 +509,13 @@ vbo_bind_arrays(struct gl_context *ctx) * need in the shader. */ if (ctx->NewState) { + /* Setting "validating" to TRUE prevents _mesa_update_state from + * invalidating what we just did. + */ + exec->validating = GL_TRUE; _mesa_update_state(ctx); + exec->validating = GL_FALSE; } - - exec->array.recalculate_inputs = GL_FALSE; } } |