Mesa (mesa_7_5_branch): wgl: Handle flush after a window is destroyed.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed Jun 24 14:30:20 UTC 2009


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Wed Jun 24 14:46:07 2009 +0100

wgl: Handle flush after a window is destroyed.

Fixes assertion failure with conform.

---

 src/gallium/state_trackers/wgl/shared/stw_device.c |   41 ++++++++++----------
 1 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c
index 1b4a2d5..ce46624 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_device.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_device.c
@@ -67,35 +67,36 @@ stw_flush_frontbuffer(struct pipe_screen *screen,
    struct stw_framebuffer *fb;
    
    fb = stw_framebuffer_from_hdc( hdc );
-   assert(fb);
-   if (fb == NULL)
-      return;
-
-   pipe_mutex_lock( fb->mutex );
+   /* fb can be NULL if window was destroyed already */
+   if (fb) {
+      pipe_mutex_lock( fb->mutex );
 
 #if DEBUG
-   {
-      struct pipe_surface *surface2;
-
-      if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_FRONT_LEFT, &surface2 ))
-         assert(0);
-      else
-         assert(surface2 == surface);
-   }
+      {
+         struct pipe_surface *surface2;
+   
+         if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_FRONT_LEFT, &surface2 ))
+            assert(0);
+         else
+            assert(surface2 == surface);
+      }
 #endif
 
 #ifdef DEBUG
-   if(stw_dev->trace_running) {
-      screen = trace_screen(screen)->screen;
-      surface = trace_surface(surface)->surface;
-   }
+      if(stw_dev->trace_running) {
+         screen = trace_screen(screen)->screen;
+         surface = trace_surface(surface)->surface;
+      }
 #endif
+   }
    
    stw_winsys->flush_frontbuffer(screen, surface, hdc);
    
-   stw_framebuffer_update(fb);
-   
-   pipe_mutex_unlock( fb->mutex );
+   if(fb) {
+      stw_framebuffer_update(fb);
+      
+      pipe_mutex_unlock( fb->mutex );
+   }
 }
 
 




More information about the mesa-commit mailing list