i915tex: Better attempt to release miptree when overriding texture image.
authorMichel Dänzer <michel@tungstengraphics.com>
Tue, 5 Jun 2007 17:55:53 +0000 (19:55 +0200)
committerMichel Dänzer <michel@tungstengraphics.com>
Tue, 5 Jun 2007 17:55:53 +0000 (19:55 +0200)
The previous approach could lead to crashes in FBO code that dereferences the
miptree struct pointer unconditionally.

src/mesa/drivers/dri/i915tex/intel_tex_image.c

index abab90cc066ca1a3958c26257d1585842bf3265f..f790b1e6f731c2fe53ba22997c973967fc6a9685 100644 (file)
@@ -378,9 +378,6 @@ intelTexImage(GLcontext * ctx,
       assert(!intelObj->mt);
    }
 
-   if (!pixels)
-      return;
-
    if (!intelObj->mt) {
       guess_and_alloc_mipmap_tree(intel, intelObj, intelImage);
       if (!intelObj->mt) {
@@ -682,6 +679,9 @@ intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname,
    if (!intelObj)
       return;
 
+   if (intelObj->mt)
+      intel_miptree_release(intel, &intelObj->mt);
+
    intelObj->imageOverride = GL_TRUE;
    intelObj->depthOverride = depth;
    intelObj->pitchOverride = pitch;