OSDN Git Service

destroy the memory manager along with the context
authorTilman Sauerbeck <tilman@freedesktop.org>
Sun, 11 Jun 2006 09:12:27 +0000 (09:12 +0000)
committerTilman Sauerbeck <tilman@freedesktop.org>
Sun, 11 Jun 2006 09:12:27 +0000 (09:12 +0000)
src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/r300/radeon_mm.c
src/mesa/drivers/dri/r300/radeon_mm.h

index ab58252..d7f027d 100644 (file)
@@ -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);
 
index 55aa5df..ce3c5e4 100644 (file)
@@ -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);
index 9df5224..81f8991 100644 (file)
@@ -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);