Mesa (master): mesa/st: add check for null front renderbuffer

Keith Whitwell keithw at kemper.freedesktop.org
Fri Mar 13 15:53:53 UTC 2009


Module: Mesa
Branch: master
Commit: b3be1651f4a45660b447881f7c61c03a1b24302a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b3be1651f4a45660b447881f7c61c03a1b24302a

Author: Keith Whitwell <keithw at vmware.com>
Date:   Fri Mar 13 15:49:49 2009 +0000

mesa/st: add check for null front renderbuffer

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 |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c
index 4fdb673..7d7d382 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -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;
+      */
+   }
 }
 
 




More information about the mesa-commit mailing list