Added proper cleanup code
authorSean D'Epagnier <sean@depagnier.com>
Tue, 24 Apr 2007 04:17:30 +0000 (21:17 -0700)
committerSean D'Epagnier <sean@depagnier.com>
Tue, 24 Apr 2007 04:17:30 +0000 (21:17 -0700)
src/mesa/drivers/fbdev/glfbdev.c

index 0ece3864d08a1964803989c02e6f84cc24bf981a..6c6511b7e53ab189311ce87ea2db6df6a7d36c6a 100644 (file)
@@ -682,9 +682,16 @@ glFBDevDestroyBuffer( GLFBDevBufferPtr buffer )
       if (buffer == curDraw || buffer == curRead) {
          glFBDevMakeCurrent( NULL, NULL, NULL);
       }
+#if 0
       /* free the software depth, stencil, accum buffers */
       _mesa_free_framebuffer_data(&buffer->glframebuffer);
       _mesa_free(buffer);
+#else
+      {
+         struct gl_framebuffer *fb = &buffer->glframebuffer;
+         _mesa_unreference_framebuffer(&fb);
+      }
+#endif
    }
 }
 
@@ -799,6 +806,13 @@ glFBDevDestroyContext( GLFBDevContextPtr context )
    GLFBDevContextPtr fbdevctx = glFBDevGetCurrentContext();
 
    if (context) {
+      GLcontext *mesaCtx = &context->glcontext;
+
+      _swsetup_DestroyContext( mesaCtx );
+      _swrast_DestroyContext( mesaCtx );
+      _tnl_DestroyContext( mesaCtx );
+      _vbo_DestroyContext( mesaCtx );
+
       if (fbdevctx == context) {
          /* destroying current context */
          _mesa_make_current(NULL, NULL, NULL);