intel: Don't segfault on TFP from a bad drawable.
authorEric Anholt <eric@anholt.net>
Fri, 12 Sep 2008 20:47:37 +0000 (13:47 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 12 Sep 2008 20:49:23 +0000 (13:49 -0700)
src/mesa/drivers/dri/intel/intel_context.c
src/mesa/drivers/dri/intel/intel_tex_image.c

index 7065bb35ee8819c359b927eba7463906fcb7e969..007dee449ca95ec82c3d343a433d9b111ef7bbde 100644 (file)
@@ -233,6 +233,9 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
                                                &count,
                                                drawable->loaderPrivate);
 
+   if (buffers == NULL)
+      return;
+
    drawable->x = 0;
    drawable->y = 0;
    drawable->backX = 0;
index d1f540b0f179b2dbc731e2b81c80d3e191c66758..70b0b3e245688f26f0183dc5d3147bf2ecf49457 100644 (file)
@@ -733,6 +733,12 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
    intel_update_renderbuffers(pDRICtx, dPriv);
 
    rb = intel_fb->color_rb[0];
+   /* If the region isn't set, then intel_update_renderbuffers was unable
+    * to get the buffers for the drawable.
+    */
+   if (rb->region == NULL)
+      return;
+
    type = GL_BGRA;
    format = GL_UNSIGNED_BYTE;
    internalFormat = (rb->region->cpp == 3 ? 3 : 4);