gallium: Reset {d,r}Priv in dri_unbind_context

The code in dri_make_current just checks the value of the pointers
to decide to update texture_stamp or not. This is buggy since a new
allocated drawable could share the same address with the previous
released drawable. Fix the stale pointer issue by always resetting
these pointers to NULL in dri_unbind_context.

v2:
   Move the reset codes to the end of the function.

Signed-off-by: Lepton Wu <lepton@chromium.org>
Cc: mesa-stable
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12050>
(cherry picked from commit 7ff30a0499)
This commit is contained in:
Lepton Wu 2021-07-23 21:27:00 -07:00 committed by Eric Engestrom
parent eb06da9e75
commit 05ec7e7901
2 changed files with 3 additions and 1 deletions

View file

@ -2614,7 +2614,7 @@
"description": "gallium: Reset {d,r}Priv in dri_unbind_context",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -271,6 +271,8 @@ dri_unbind_context(__DRIcontext * cPriv)
stapi->make_current(stapi, NULL, NULL, NULL);
}
}
ctx->dPriv = NULL;
ctx->rPriv = NULL;
return GL_TRUE;
}