Mesa (r6xx-rewrite): fix segfault when running glxinfo

Alex Deucher agd5f at kemper.freedesktop.org
Tue May 26 17:05:19 UTC 2009


Module: Mesa
Branch: r6xx-rewrite
Commit: 17417fc8eeaf5f88452fa3d37a763cee3c92a28c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=17417fc8eeaf5f88452fa3d37a763cee3c92a28c

Author: Alex Deucher <alexdeucher at gmail.com>
Date:   Tue May 26 11:13:44 2009 -0400

fix segfault when running glxinfo

---

 src/mesa/drivers/dri/r600/r600_context.c           |    5 +++--
 src/mesa/drivers/dri/r600/r600_emit.c              |    6 ++++--
 .../drivers/dri/radeon/radeon_common_context.c     |    5 ++++-
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c
index e6c03ec..5be486b 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -453,9 +453,10 @@ void
 r600DestroyContext (__DRIcontextPrivate * driContextPriv)
 {
     GET_CURRENT_CONTEXT (ctx);
-    context_t *context = R700_CONTEXT(ctx);
+    context_t *context = ctx ? R700_CONTEXT(ctx) : NULL;
 
-    (context->chipobj.DestroyChipObj)(context->chipobj.pvChipObj);
+    if (context)
+	    (context->chipobj.DestroyChipObj)(context->chipobj.pvChipObj);
 }
 
 
diff --git a/src/mesa/drivers/dri/r600/r600_emit.c b/src/mesa/drivers/dri/r600/r600_emit.c
index dee4cd3..e4ba656 100644
--- a/src/mesa/drivers/dri/r600/r600_emit.c
+++ b/src/mesa/drivers/dri/r600/r600_emit.c
@@ -234,8 +234,10 @@ GLboolean r600DeleteShader(GLcontext * ctx,
 {
     struct radeon_bo * pbo = (struct radeon_bo *)shaderbo;
 
-    radeon_bo_unmap(pbo);
-    radeon_bo_unref(pbo); /* when bo->cref <= 0, bo will be bo_free */
+    if (pbo) {
+	    radeon_bo_unmap(pbo);
+	    radeon_bo_unref(pbo); /* when bo->cref <= 0, bo will be bo_free */
+    }
 
     return GL_TRUE;
 }
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index 4098251..1e90086 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -233,7 +233,7 @@ void radeonDestroyContext(__DRIcontextPrivate *driContextPriv )
 #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R600) /* +r6/r7 */
 	    if (IS_R600_CLASS(screen))
         {
-		    r600DestroyContext(driContextPriv);
+		r600DestroyContext(driContextPriv);
         }
 #endif
 
@@ -267,6 +267,9 @@ void radeonDestroyContext(__DRIcontextPrivate *driContextPriv )
 		
 		rcommonDestroyCmdBuf(radeon);
 
+#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R600) /* +r6/r7 */
+	    if (!IS_R600_CLASS(screen))
+#endif
 		radeon_destroy_atom_list(radeon);
 
 		if (radeon->state.scissor.pClipRects) {




More information about the mesa-commit mailing list