check for ctx==NULL in st_renderbuffer_delete()
authorBrian <brian.paul@tungstengraphics.com>
Mon, 13 Aug 2007 20:53:27 +0000 (14:53 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Mon, 13 Aug 2007 20:53:27 +0000 (14:53 -0600)
src/mesa/state_tracker/st_cb_fbo.c

index bb588d10ea23966a67a0aaa713d87e1ebf6111d0..3048765114dcdea4fb6cd40506338f4c554b5fc5 100644 (file)
@@ -118,15 +118,20 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
 static void
 st_renderbuffer_delete(struct gl_renderbuffer *rb)
 {
-   GET_CURRENT_CONTEXT(ctx);
-   struct pipe_context *pipe = ctx->st->pipe;
    struct st_renderbuffer *strb = st_renderbuffer(rb);
-   ASSERT(strb);
-   if (strb && strb->surface) {
-      if (strb->surface->region) {
-         pipe->region_release(pipe, &strb->surface->region);
+   GET_CURRENT_CONTEXT(ctx);
+   if (ctx) {
+      struct pipe_context *pipe = ctx->st->pipe;
+      ASSERT(strb);
+      if (strb && strb->surface) {
+         if (strb->surface->region) {
+            pipe->region_release(pipe, &strb->surface->region);
+         }
+         free(strb->surface);
       }
-      free(strb->surface);
+   }
+   else {
+      _mesa_warning(NULL, "st_renderbuffer_delete() called, but no current context");
    }
    free(strb);
 }