st/mesa: unmap pbo after updating cache
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 28 Nov 2019 16:51:20 +0000 (17:51 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 29 Nov 2019 07:45:06 +0000 (07:45 +0000)
Unmapping first leads to accessing an invalid pointer. So let's switch
these lines around.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_cb_drawpixels.c

index fc11bc3ae479463dd876111015dbae6b05725959..a220c841597ae794293d33259b4ba67f663ea122 100644 (file)
@@ -722,12 +722,12 @@ make_texture(struct st_context *st,
       ctx->_ImageTransferState = imageTransferStateSave;
    }
 
-   _mesa_unmap_pbo_source(ctx, unpack);
-
 #if USE_DRAWPIXELS_CACHE
    cache_drawpixels_image(st, width, height, format, type, unpack, pixels, pt);
 #endif
 
+   _mesa_unmap_pbo_source(ctx, unpack);
+
    return pt;
 }