summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Liu <net147@gmail.com>2013-12-15 18:24:00 -0700
committerCarl Worth <cworth@cworth.org>2014-01-02 15:57:40 -0800
commit8518b6360d407c07ae2a00013ff8b7a636c9bfdf (patch)
tree3b072b5ecd7dcd6fa553be6808cff909d636ca7b
parentffd89b27a787752468b9f6aa41068f2d4812e38e (diff)
llvmpipe: use pipe_sampler_view_release() to avoid segfault
This fixes another case of faulting when freeing a pipe_sampler_view that belongs to a previously destroyed context. Cc: "10.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Jonathan Liu <net147@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com> (cherry picked from commit 7990ab58fa01cbebcefd63dd25af5fd6fdddf019)
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_sampler.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
index 1d3db0f25c7..ff498f7f15a 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
@@ -136,6 +136,12 @@ llvmpipe_set_sampler_views(struct pipe_context *pipe,
/* set the new sampler views */
for (i = 0; i < num; i++) {
+ /* Note: we're using pipe_sampler_view_release() here to work around
+ * a possible crash when the old view belongs to another context that
+ * was already destroyed.
+ */
+ pipe_sampler_view_release(pipe,
+ &llvmpipe->sampler_views[shader][start + i]);
pipe_sampler_view_reference(&llvmpipe->sampler_views[shader][start + i],
views[i]);
}