glx/dri2: Fix dri2CopySubBuffer() again.
authorMichel Dänzer <daenzer@vmware.com>
Tue, 20 Jul 2010 10:21:17 +0000 (12:21 +0200)
committerMichel Dänzer <michel@daenzer.net>
Tue, 20 Jul 2010 10:21:17 +0000 (12:21 +0200)
Only refresh the fake front buffer if there is one, and only destroy the region
once.

Fixes X11 protocol errors reported by 'mcgreg' on IRC.

src/glx/dri2_glx.c

index 4fbe9496b111420c81e6122953cca0823bfdfc51..be8671d906944551afb01896fc47a571b24be3c5 100644 (file)
@@ -352,13 +352,14 @@ dri2CopySubBuffer(__GLXDRIdrawable *pdraw, int x, int y, int width, int height)
    region = XFixesCreateRegion(psc->base.dpy, &xrect, 1);
    DRI2CopyRegion(psc->base.dpy, pdraw->xDrawable, region,
                   DRI2BufferFrontLeft, DRI2BufferBackLeft);
-   XFixesDestroyRegion(psc->base.dpy, region);
 
    /* Refresh the fake front (if present) after we just damaged the real
     * front.
     */
-   DRI2CopyRegion(psc->base.dpy, pdraw->xDrawable, region,
-                 DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
+   if (priv->have_fake_front)
+      DRI2CopyRegion(psc->base.dpy, pdraw->xDrawable, region,
+                    DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
+
    XFixesDestroyRegion(psc->base.dpy, region);
 }