_mesa_destroy_context() frees radeon->glCtx so we must not access it afterwards
authorTilman Sauerbeck <tilman@freedesktop.org>
Tue, 11 Jul 2006 18:35:24 +0000 (18:35 +0000)
committerTilman Sauerbeck <tilman@freedesktop.org>
Tue, 11 Jul 2006 18:35:24 +0000 (18:35 +0000)
src/mesa/drivers/dri/r300/radeon_context.c

index 5de16104f0ab8fd98e83fded3ed20f73fa2d2c5c..d886788b3412b496fe7b4af3571b8c68501f1646 100644 (file)
@@ -201,14 +201,15 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
  */
 void radeonCleanupContext(radeonContextPtr radeon)
 {
+       /* _mesa_destroy_context() might result in calls to functions that
+        * depend on the DriverCtx, so don't set it to NULL before.
+        *
+        * radeon->glCtx->DriverCtx = NULL;
+        */
+
        /* free the Mesa context */
        _mesa_destroy_context(radeon->glCtx);
 
-       /* the above call might result in calls to functions that depend on
-        * the DriverCtx.
-        */
-       radeon->glCtx->DriverCtx = NULL;
-
        if (radeon->state.scissor.pClipRects) {
                FREE(radeon->state.scissor.pClipRects);
                radeon->state.scissor.pClipRects = 0;