mesa/st: add check for null front renderbuffer
authorKeith Whitwell <keithw@vmware.com>
Fri, 13 Mar 2009 15:49:49 +0000 (15:49 +0000)
committerKeith Whitwell <keithw@vmware.com>
Fri, 13 Mar 2009 15:53:48 +0000 (15:53 +0000)
Not sure if this indicates a problem elsewhere, but without this check
trivial/tri-fbo.c segfaults on resize.  With the patch, it renders
correctly.

src/mesa/state_tracker/st_cb_flush.c

index 4fdb67308799639638f3c0993dc73688f31a257d..7d7d3823c99f8ccd551e0894fd6136eea091a904 100644 (file)
@@ -63,16 +63,19 @@ display_front_buffer(struct st_context *st)
    GLframebuffer *fb = st->ctx->DrawBuffer;
    struct st_renderbuffer *strb
       = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
-   struct pipe_surface *front_surf = strb->surface;
 
-   /* Hook for copying "fake" frontbuffer if necessary:
-    */
-   st->pipe->screen->flush_frontbuffer( st->pipe->screen, front_surf,
-                                        st->pipe->priv );
-
-   /*
-   st->frontbuffer_status = FRONT_STATUS_UNDEFINED;
-   */
+   if (strb) {
+      struct pipe_surface *front_surf = strb->surface;
+      
+      /* Hook for copying "fake" frontbuffer if necessary:
+       */
+      st->pipe->screen->flush_frontbuffer( st->pipe->screen, front_surf,
+                                           st->pipe->priv );
+
+      /*
+        st->frontbuffer_status = FRONT_STATUS_UNDEFINED;
+      */
+   }
 }