Made ENTER_GL() - LEAVE_GL() free X11 lock on exception inside opengl, code
Massimo
max at veneto.com
Sat Jun 28 04:40:52 CDT 2008
That one avoids a stale lock when an exception is thrown inside OpenGL
code. That's done enclosing opengl calls inside a __TRY...__FINALLY
block, modifying ENTER_GL() and LEAVE_GL() macros.
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 ++++++
tools/winewrapper | 2 ++
3 files changed, 14 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 );
/***********************************************************************
diff --git a/tools/winewrapper b/tools/winewrapper
index 13be936..51a305f 100755
--- a/tools/winewrapper
+++ b/tools/winewrapper
@@ -53,6 +53,8 @@ elif [ -x "$appdir/../../server/wineserver" ]
then topdir="$appdir/../.."
elif [ -x "$appdir/../../../server/wineserver" ]
then topdir="$appdir/../../.."
+elif [ -x "$HOME/sources/wine/server/wineserver" ]
+then topdir="$HOME/sources/wine"
else
echo "$0: could not locate Wine source tree"
exit 1
--
1.5.4.3
More information about the wine-patches
mailing list