Fix crash when debug output is enabled and sarea is notset in r200Clear
[mesa.git] / src / mesa / main / context.c
index d9f10468aaef10ce531c4cb099b6c005b0fa3ff9..eafe292a1f2d686bd48f8eae6d082f13898d885f 100644 (file)
@@ -1014,6 +1014,16 @@ _mesa_free_context_data( GLcontext *ctx )
 
    _mesa_delete_array_object(ctx, ctx->Array.DefaultArrayObj);
 
+#if FEATURE_ARB_pixel_buffer_object
+   _mesa_reference_buffer_object(ctx, &ctx->Pack.BufferObj, NULL);
+   _mesa_reference_buffer_object(ctx, &ctx->Unpack.BufferObj, NULL);
+#endif
+
+#if FEATURE_ARB_vertex_buffer_object
+   _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL);
+   _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, NULL);
+#endif
+
    /* free dispatch tables */
    _mesa_free(ctx->Exec);
    _mesa_free(ctx->Save);
@@ -1262,7 +1272,7 @@ initialize_framebuffer_size(GLcontext *ctx, GLframebuffer *fb)
  * \param drawBuffer  the drawing framebuffer
  * \param readBuffer  the reading framebuffer
  */
-void
+GLboolean
 _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
                     GLframebuffer *readBuffer )
 {
@@ -1275,14 +1285,14 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
       if (!check_compatible(newCtx, drawBuffer)) {
          _mesa_warning(newCtx,
               "MakeCurrent: incompatible visuals for context and drawbuffer");
-         return;
+         return GL_FALSE;
       }
    }
    if (newCtx && readBuffer && newCtx->WinSysReadBuffer != readBuffer) {
       if (!check_compatible(newCtx, readBuffer)) {
          _mesa_warning(newCtx,
               "MakeCurrent: incompatible visuals for context and readbuffer");
-         return;
+         return GL_FALSE;
       }
    }
 
@@ -1387,6 +1397,8 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
         newCtx->FirstTimeCurrent = GL_FALSE;
       }
    }
+   
+   return GL_TRUE;
 }