Mesa (mesa_7_5_branch): wgl: Ensure we only create framebuffers for HDC associated with a window.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Jun 1 02:39:25 UTC 2009


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Sun May 31 11:10:22 2009 -0700

wgl: Ensure we only create framebuffers for HDC associated with a window.

---

 .../state_trackers/wgl/shared/stw_framebuffer.c    |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
index 45ac347..030a155 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
@@ -102,15 +102,21 @@ stw_framebuffer_create_locked(
    HDC hdc,
    int iPixelFormat )
 {
+   HWND hWnd;
    struct stw_framebuffer *fb;
    const struct stw_pixelformat_info *pfi;
 
+   /* We only support drawing to a window. */
+   hWnd = WindowFromDC( hdc );
+   if(!hWnd)
+      return NULL;
+   
    fb = CALLOC_STRUCT( stw_framebuffer );
    if (fb == NULL)
       return NULL;
 
    fb->hDC = hdc;
-   fb->hWnd = WindowFromDC( hdc );
+   fb->hWnd = hWnd;
    fb->iPixelFormat = iPixelFormat;
 
    fb->pfi = pfi = stw_pixelformat_get_info( iPixelFormat - 1 );




More information about the mesa-commit mailing list