Mesa (master): mesa/st: workaround for crashes in st_copy_texsubimage

Keith Whitwell keithw at kemper.freedesktop.org
Tue Apr 28 10:17:39 PDT 2009


Module: Mesa
Branch: master
Commit: afd16512bc354cf1a7220cb9bf3ce445503c7af4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=afd16512bc354cf1a7220cb9bf3ce445503c7af4

Author: Keith Whitwell <keithw at vmware.com>
Date:   Mon Apr 27 18:56:26 2009 +0100

mesa/st: workaround for crashes in st_copy_texsubimage

Proper fix for this hasn't been identified, but avoid crashing.

---

 src/mesa/state_tracker/st_cb_texture.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index aeb7511..b7b791d 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -51,6 +51,7 @@
 #include "state_tracker/st_texture.h"
 #include "state_tracker/st_gen_mipmap.h"
 #include "state_tracker/st_inlines.h"
+#include "state_tracker/st_atom.h"
 
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
@@ -1317,6 +1318,10 @@ st_copy_texsubimage(GLcontext *ctx,
    /* any rendering in progress must complete before we grab the fb image */
    st_finish(ctx->st);
 
+   /* make sure finalize_textures has been called? 
+    */
+   if (0) st_validate_state(ctx->st);
+
    /* determine if copying depth or color data */
    if (texBaseFormat == GL_DEPTH_COMPONENT ||
        texBaseFormat == GL_DEPTH24_STENCIL8) {
@@ -1330,6 +1335,11 @@ st_copy_texsubimage(GLcontext *ctx,
       strb = st_renderbuffer(fb->_ColorReadBuffer);
    }
 
+   if (!strb || !strb->surface || !stImage->pt) {
+      debug_printf("%s: null strb or stImage\n", __FUNCTION__);
+      return;
+   }
+
    assert(strb);
    assert(strb->surface);
    assert(stImage->pt);



More information about the mesa-commit mailing list