summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_pipe_sampler.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2012-02-16 12:23:16 -0700
committerBrian Paul <brianp@vmware.com>2012-02-23 07:49:09 -0700
commit0fffaa512cbd347af0b81571753d4da6dd58a81e (patch)
tree06c789c3d39547422a895ae3a33512c8b8f9c823 /src/gallium/drivers/svga/svga_pipe_sampler.c
parentbe05388ce983face72ca17241f0f2e154c11f435 (diff)
downloadexternal_mesa3d-0fffaa512cbd347af0b81571753d4da6dd58a81e.zip
external_mesa3d-0fffaa512cbd347af0b81571753d4da6dd58a81e.tar.gz
external_mesa3d-0fffaa512cbd347af0b81571753d4da6dd58a81e.tar.bz2
svga: 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. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/drivers/svga/svga_pipe_sampler.c')
-rw-r--r--src/gallium/drivers/svga/svga_pipe_sampler.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
index 13c7b18..c1ea4f8 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -225,8 +225,12 @@ svga_set_fragment_sampler_views(struct pipe_context *pipe,
}
for (i = 0; i < num; i++) {
- pipe_sampler_view_reference(&svga->curr.sampler_views[i],
- views[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, &svga->curr.sampler_views[i]);
+ pipe_sampler_view_reference(&svga->curr.sampler_views[i], views[i]);
if (!views[i])
continue;