wgl: Don't flush surface if it is NULL.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 27 Mar 2009 21:43:24 +0000 (21:43 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 27 Mar 2009 21:43:24 +0000 (21:43 +0000)
Just a quick fix to prevent segfaults with glean.

src/gallium/state_trackers/wgl/shared/stw_framebuffer.c

index 2f0d8cbc318c36112b233198be39c8e7432cd657..4641884f950c3d053fb82f0ede1786b68a41b6b0 100644 (file)
@@ -225,11 +225,14 @@ stw_swap_buffers(
     */
    st_notify_swapbuffers( fb->stfb );
 
-   st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surf );
-
-   stw_dev->stw_winsys->flush_frontbuffer(stw_dev->screen,
-                                          surf,
-                                          hdc );
+   if(st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surf )) {
+      stw_dev->stw_winsys->flush_frontbuffer(stw_dev->screen,
+                                             surf,
+                                             hdc );
+   }
+   else {
+       /* FIXME: this shouldn't happen, but does on glean */
+   }
 
    return TRUE;
 }