Made ENTER_GL() - LEAVE_GL() free X11 lock on exception inside opengl, code

Massimo Del Fedele max at veneto.com
Sat Jun 28 05:03:54 CDT 2008


Sorry for duplicate, previous one had some spurious stuffs an dmissing 
full name... it was my very first post here since long :-)

 From 31327546fc30520c80433fc964d7bd3ba4f80fa9 Mon Sep 17 00:00:00 2001
From: Massimo Del Fedele <max at veneto.com>
Date: Sat, 28 Jun 2008 12:00:17 +0200
Subject: Made ENTER_GL() - LEAVE_GL() free X11 lock on exception inside 
opengl
   code

---
  dlls/opengl32/opengl_ext.h |    8 ++++++--
  dlls/opengl32/wgl.c        |    6 ++++++
  2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/opengl32/opengl_ext.h b/dlls/opengl32/opengl_ext.h
index 8ae7c2f..9892351 100644
--- a/dlls/opengl32/opengl_ext.h
+++ b/dlls/opengl32/opengl_ext.h
@@ -40,6 +40,9 @@
  #define WINAPI      __stdcall
  #define APIENTRY    WINAPI

+#include "wine/library.h"
+#include "wine/exception.h"
+
  /* X11 locking */

  extern void (*wine_tsx11_lock_ptr)(void);
@@ -47,8 +50,9 @@ extern void (*wine_tsx11_unlock_ptr)(void);

  /* As GLX relies on X, this is needed */
  void enter_gl(void);
-#define ENTER_GL() enter_gl()
-#define LEAVE_GL() wine_tsx11_unlock_ptr()
+void CALLBACK leave_gl(BOOL);
+#define ENTER_GL() enter_gl(); __TRY {
+#define LEAVE_GL() } __FINALLY(leave_gl)


  typedef struct {
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 6fbdeb4..7e31e20 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -114,6 +114,12 @@ void enter_gl(void)
      return;
  }

+void CALLBACK leave_gl(BOOL dummy)
+{
+    wine_tsx11_unlock_ptr();
+    return;
+}
+
  const GLubyte * WINAPI wine_glGetString( GLenum name );

  /***********************************************************************
-- 
1.5.4.3





More information about the wine-patches mailing list