fix segfault when running glxinfo

This commit is contained in:
Alex Deucher
2009-05-26 11:13:44 -04:00
parent 4a28974cf5
commit 17417fc8ee
3 changed files with 11 additions and 5 deletions

View File

@@ -453,9 +453,10 @@ void
r600DestroyContext (__DRIcontextPrivate * driContextPriv) r600DestroyContext (__DRIcontextPrivate * driContextPriv)
{ {
GET_CURRENT_CONTEXT (ctx); 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);
} }

View File

@@ -234,8 +234,10 @@ GLboolean r600DeleteShader(GLcontext * ctx,
{ {
struct radeon_bo * pbo = (struct radeon_bo *)shaderbo; struct radeon_bo * pbo = (struct radeon_bo *)shaderbo;
radeon_bo_unmap(pbo); if (pbo) {
radeon_bo_unref(pbo); /* when bo->cref <= 0, bo will be bo_free */ radeon_bo_unmap(pbo);
radeon_bo_unref(pbo); /* when bo->cref <= 0, bo will be bo_free */
}
return GL_TRUE; return GL_TRUE;
} }

View File

@@ -233,7 +233,7 @@ void radeonDestroyContext(__DRIcontextPrivate *driContextPriv )
#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R600) /* +r6/r7 */ #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R600) /* +r6/r7 */
if (IS_R600_CLASS(screen)) if (IS_R600_CLASS(screen))
{ {
r600DestroyContext(driContextPriv); r600DestroyContext(driContextPriv);
} }
#endif #endif
@@ -267,6 +267,9 @@ void radeonDestroyContext(__DRIcontextPrivate *driContextPriv )
rcommonDestroyCmdBuf(radeon); rcommonDestroyCmdBuf(radeon);
#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R600) /* +r6/r7 */
if (!IS_R600_CLASS(screen))
#endif
radeon_destroy_atom_list(radeon); radeon_destroy_atom_list(radeon);
if (radeon->state.scissor.pClipRects) { if (radeon->state.scissor.pClipRects) {