Fix mismatched map/unmap of buffers in swrast read/drawpixels error paths.
authorEric Anholt <eric@anholt.net>
Tue, 18 Dec 2007 22:51:42 +0000 (14:51 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 18 Dec 2007 22:51:42 +0000 (14:51 -0800)
src/mesa/swrast/s_drawpix.c
src/mesa/swrast/s_readpix.c

index 0cf425e1c62a588e270b4cdede692661678512ef..969787381c24e4c3511903937f2758a1d5acde76 100644 (file)
@@ -842,7 +842,8 @@ _swrast_DrawPixels( GLcontext *ctx,
                                      format, type, pixels)) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glDrawPixels(invalid PBO access)");
-         goto end;
+         RENDER_FINISH(swrast, ctx);
+        return;
       }
       buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
                                               GL_READ_ONLY_ARB,
@@ -850,7 +851,8 @@ _swrast_DrawPixels( GLcontext *ctx,
       if (!buf) {
          /* buffer is already mapped - that's an error */
          _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)");
-         goto end;
+         RENDER_FINISH(swrast, ctx);
+        return;
       }
       pixels = ADD_POINTERS(buf, pixels);
    }
@@ -890,8 +892,6 @@ _swrast_DrawPixels( GLcontext *ctx,
       /* don't return yet, clean-up */
    }
 
-end:
-
    RENDER_FINISH(swrast,ctx);
 
    if (unpack->BufferObj->Name) {
index 916ddc1b97392f96b1f484e8528ac5eb127847aa..8df15c8704e66c1e5dd90529def483f741bf5c01 100644 (file)
@@ -570,7 +570,8 @@ _swrast_ReadPixels( GLcontext *ctx,
    /* Do all needed clipping here, so that we can forget about it later */
    if (!_mesa_clip_readpixels(ctx, &x, &y, &width, &height, &clippedPacking)) {
       /* The ReadPixels region is totally outside the window bounds */
-      goto end;
+      RENDER_FINISH(swrast, ctx);
+      return;
    }
 
    if (clippedPacking.BufferObj->Name) {
@@ -580,7 +581,8 @@ _swrast_ReadPixels( GLcontext *ctx,
                                      format, type, pixels)) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glReadPixels(invalid PBO access)");
-         goto end;
+        RENDER_FINISH(swrast, ctx);
+        return;
       }
       buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
                                               GL_WRITE_ONLY_ARB,
@@ -588,7 +590,8 @@ _swrast_ReadPixels( GLcontext *ctx,
       if (!buf) {
          /* buffer is already mapped - that's an error */
          _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)");
-         goto end;
+        RENDER_FINISH(swrast, ctx);
+        return;
       }
       pixels = ADD_POINTERS(buf, pixels);
    }
@@ -629,8 +632,6 @@ _swrast_ReadPixels( GLcontext *ctx,
          /* don't return yet, clean-up */
    }
 
-
-end:
    RENDER_FINISH(swrast, ctx);
 
    if (clippedPacking.BufferObj->Name) {