From 51eb359ea96a048f942b5e72c5634d36d9859d97 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Sun, 11 Jun 2006 09:12:27 +0000 Subject: destroy the memory manager along with the context --- src/mesa/drivers/dri/r300/r300_context.c | 7 +++++++ src/mesa/drivers/dri/r300/radeon_mm.c | 9 +++++++++ src/mesa/drivers/dri/r300/radeon_mm.h | 1 + 3 files changed, 17 insertions(+) (limited to 'src/mesa/drivers/dri/r300') diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index ab582525abc..d7f027dcb82 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -486,6 +486,13 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv) radeonCleanupContext(&r300->radeon); +#ifdef USER_BUFFERS + /* the memory manager might be accessed when Mesa frees the shared + * state, so don't destroy it earlier + */ + radeon_mm_destroy(r300); +#endif + /* free the option cache */ driDestroyOptionCache(&r300->radeon.optionCache); diff --git a/src/mesa/drivers/dri/r300/radeon_mm.c b/src/mesa/drivers/dri/r300/radeon_mm.c index 55aa5df01a6..ce3c5e4b9ab 100644 --- a/src/mesa/drivers/dri/r300/radeon_mm.c +++ b/src/mesa/drivers/dri/r300/radeon_mm.c @@ -69,6 +69,15 @@ void radeon_mm_init(r300ContextPtr rmesa) resize_u_list(rmesa); } +void radeon_mm_destroy(r300ContextPtr rmesa) +{ + _mesa_free(rmesa->rmm->u_list); + rmesa->rmm->u_list = NULL; + + _mesa_free(rmesa->rmm); + rmesa->rmm = NULL; +} + void *radeon_mm_ptr(r300ContextPtr rmesa, int id) { assert(id <= rmesa->rmm->u_last); diff --git a/src/mesa/drivers/dri/r300/radeon_mm.h b/src/mesa/drivers/dri/r300/radeon_mm.h index 9df5224ddeb..81f89917e60 100644 --- a/src/mesa/drivers/dri/r300/radeon_mm.h +++ b/src/mesa/drivers/dri/r300/radeon_mm.h @@ -26,6 +26,7 @@ struct radeon_memory_manager { }; extern void radeon_mm_init(r300ContextPtr rmesa); +extern void radeon_mm_destroy(r300ContextPtr rmesa); extern void *radeon_mm_ptr(r300ContextPtr rmesa, int id); extern int radeon_mm_find(r300ContextPtr rmesa, void *ptr); extern int radeon_mm_alloc(r300ContextPtr rmesa, int alignment, int size); -- cgit v1.2.3