OSDN Git Service

r300: Also update window state when it's already bound but its stamp changed.
authorMichel Dänzer <michel@tungstengraphics.com>
Fri, 9 Mar 2007 08:43:17 +0000 (09:43 +0100)
committerMichel Dänzer <michel@tungstengraphics.com>
Fri, 9 Mar 2007 08:43:17 +0000 (09:43 +0100)
And set new cliprects before deriving other state from them. This ensures
cliprects aren't accessed after having been freed.

Thanks to Panagiotis Papadakos for testing various iterations of this.

src/mesa/drivers/dri/r300/radeon_context.c

index d66f1dc..66d1b15 100644 (file)
@@ -273,15 +273,15 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
                                              &radeon->vbl_seq);
                }
 
+               radeon->dri.readable = driReadPriv;
+
                if (radeon->dri.drawable != driDrawPriv ||
-                   radeon->dri.readable != driReadPriv) {
+                   radeon->lastStamp != driDrawPriv->lastStamp) {
                        radeon->dri.drawable = driDrawPriv;
-                       radeon->dri.readable = driReadPriv;
 
+                       radeonSetCliprects(radeon);
                        r300UpdateWindow(radeon->glCtx);
                        r300UpdateViewportOffset(radeon->glCtx);
-
-                       radeonSetCliprects(radeon);
                }
 
                _mesa_make_current(radeon->glCtx,