[Mesa-dev] [PATCH 01/11] intel: Fix segfaults in MapTextureImage when mt == NULL.

Eric Anholt eric at anholt.net
Thu Sep 22 12:34:13 PDT 2011


A later patch to use Mesa core with MapTextureImage tripped over this
-- apparently we hadn't actually done it on a ->Data != NULL texture
before!
---
 src/mesa/drivers/dri/intel/intel_tex.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c
index 8d3cbd6..f8c3f77 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -113,7 +113,7 @@ intel_map_texture_image(struct gl_context *ctx,
     * row of blocks.  intel_miptree_get_image_offset() already does
     * the divide.
     */
-   _mesa_get_format_block_size(mt->format, &bw, &bh);
+   _mesa_get_format_block_size(tex_image->TexFormat, &bw, &bh);
    assert(y % bh == 0);
    y /= bh;
 
@@ -150,7 +150,8 @@ intel_unmap_texture_image(struct gl_context *ctx,
    struct intel_context *intel = intel_context(ctx);
    struct intel_texture_image *intel_image = intel_texture_image(tex_image);
 
-   intel_region_unmap(intel, intel_image->mt->region);
+   if (intel_image->mt)
+      intel_region_unmap(intel, intel_image->mt->region);
 
    if (intel_image->stencil_rb) {
       /*
-- 
1.7.5.4



More information about the mesa-dev mailing list