st/mesa: Clear texture's views when texture is removed from Shared->TexObjects

If texture is shared between several contexts, calling glDeleteTextures
will remove it from ctx->Shared->TexObjects - which makes impossible for
contexts, when destroyed, to release their views to this texture. Which
leaves dangling pointers to destroyed contexts.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2960
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5106>
This commit is contained in:
Danylo Piliaiev
2020-05-18 20:44:58 +03:00
committed by Marge Bot
parent a51ab5f956
commit 045267d1e6
4 changed files with 28 additions and 1 deletions

View File

@@ -226,7 +226,7 @@ st_texture_release_all_sampler_views(struct st_context *st,
for (unsigned i = 0; i < views->count; ++i) {
struct st_sampler_view *stsv = &views->views[i];
if (stsv->view) {
if (stsv->st != st) {
if (stsv->st && stsv->st != st) {
/* Transfer this reference to the zombie list. It will
* likely be freed when the zombie list is freed.
*/