[Mesa-dev] [PATCH 1/3] util: set all unused cbufs to NULL in util_copy_framebuffer_state()

Brian Paul brianp at vmware.com
Thu Nov 7 16:33:11 PST 2013


This helps fix an issue in the svga driver, and is just safer all-around.
---
 src/gallium/auxiliary/util/u_framebuffer.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_framebuffer.c b/src/gallium/auxiliary/util/u_framebuffer.c
index 7803ec6..f84485d 100644
--- a/src/gallium/auxiliary/util/u_framebuffer.c
+++ b/src/gallium/auxiliary/util/u_framebuffer.c
@@ -88,7 +88,8 @@ util_copy_framebuffer_state(struct pipe_framebuffer_state *dst,
    for (i = 0; i < src->nr_cbufs; i++)
       pipe_surface_reference(&dst->cbufs[i], src->cbufs[i]);
 
-   for (i = src->nr_cbufs; i < dst->nr_cbufs; i++)
+   /* Set remaining dest cbuf pointers to NULL */
+   for ( ; i < Elements(dst->cbufs); i++)
       pipe_surface_reference(&dst->cbufs[i], NULL);
 
    dst->nr_cbufs = src->nr_cbufs;
-- 
1.7.10.4



More information about the mesa-dev mailing list