mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 17:10:11 +01:00
mesa: Avoid leaking surface in st_renderbuffer_delete
v2: add comment in code Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100741 Fixes:a5e733c6b5mesa: drop current draw/read buffer when ctx is released Reviewed-by: Rob Clark <robdclark@gmail.com> (v1) Reviewed-by: Emil Velikov <emil.velikov@collabora.com> (cherry picked from commitfd6c2a3f3e) [Emil Velikov: s/CurrentClientDispatch/CurrentDispatch/] Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Conflicts: src/mesa/main/context.c
This commit is contained in:
parent
4c3b89a45f
commit
4242dfa330
1 changed files with 8 additions and 2 deletions
|
|
@ -1646,17 +1646,23 @@ _mesa_make_current( struct gl_context *newCtx,
|
|||
_mesa_flush(curCtx);
|
||||
|
||||
/* We used to call _glapi_check_multithread() here. Now do it in drivers */
|
||||
_glapi_set_context((void *) newCtx);
|
||||
assert(_mesa_get_current_context() == newCtx);
|
||||
|
||||
if (!newCtx) {
|
||||
_glapi_set_dispatch(NULL); /* none current */
|
||||
/* We need old ctx to correctly release Draw/ReadBuffer
|
||||
* and avoid a surface leak in st_renderbuffer_delete.
|
||||
* Therefore, first drop buffers then set new ctx to NULL.
|
||||
*/
|
||||
if (curCtx) {
|
||||
_mesa_reference_framebuffer(&curCtx->WinSysDrawBuffer, NULL);
|
||||
_mesa_reference_framebuffer(&curCtx->WinSysReadBuffer, NULL);
|
||||
}
|
||||
_glapi_set_context(NULL);
|
||||
assert(_mesa_get_current_context() == NULL);
|
||||
}
|
||||
else {
|
||||
_glapi_set_context((void *) newCtx);
|
||||
assert(_mesa_get_current_context() == newCtx);
|
||||
_glapi_set_dispatch(newCtx->CurrentDispatch);
|
||||
|
||||
if (drawBuffer && readBuffer) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue