From: Sebastian Lackner Subject: glu32: Fix wrapper function for glu[Begin|End]Polygon and gluNextContour. Message-Id: <5416E39D.8000406@fds-team.de> Date: Mon, 15 Sep 2014 15:03:25 +0200 Fixes: https://bugs.winehq.org/show_bug.cgi?id=37239 The old wrappers didn't contain the translation from wine_tess to the real tess handle, which caused a deadlock in the linux library. Moreover we unfortunatly can't forward wine_gluBeginPolygon directly to gluBeginPolygon - there is no way to specify a user data pointer, which would have the effect that all callbacks are called with a NULL (or invalid) user data - leading to a crash when the callback tries to access members of the wine_tess structure. Since gluBeginPolygon / gluEndPolygon / gluNextContour are deprecated anyway and only forwarded to gluTess* functions, the easiest way to solve that is to do the forwarding directly in Wine. Please note that arg1 in gluNextContour is ignored. This argument is only a hint anyway, so it should be safe to do that. --- dlls/glu32/glu.c | 55 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 24 deletions(-) From b2da0bea85145c9e179bd6f83c95b1ebcf556fd2 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 14 Sep 2014 07:07:13 +0200 Subject: glu32: Fix wrapper function for glu[Begin|End]Polygon and gluNextContour. --- dlls/glu32/glu.c | 55 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/dlls/glu32/glu.c b/dlls/glu32/glu.c index 46a2336..4f0d0e2 100644 --- a/dlls/glu32/glu.c +++ b/dlls/glu32/glu.c @@ -352,30 +352,6 @@ int WINAPI wine_gluNurbsCallback(void *arg0,int arg1,void *arg2) { } /*********************************************************************** - * gluBeginPolygon (GLU32.@) - */ -extern int gluBeginPolygon(void *arg0); -int WINAPI wine_gluBeginPolygon(void *arg0) { - return gluBeginPolygon(arg0); -} - -/*********************************************************************** - * gluEndPolygon (GLU32.@) - */ -extern int gluEndPolygon(void *arg0); -int WINAPI wine_gluEndPolygon(void *arg0) { - return gluEndPolygon(arg0); -} - -/*********************************************************************** - * gluNextContour (GLU32.@) - */ -extern int gluNextContour(void *arg0,int arg1); -int WINAPI wine_gluNextContour(void *arg0,int arg1) { - return gluNextContour(arg0,arg1); -} - -/*********************************************************************** * gluGetString (GLU32.@) */ extern int gluGetString(int arg0); @@ -617,3 +593,34 @@ void WINAPI wine_gluTessNormal(void *tess, double arg1, double arg2, double arg3 wine_tess_t *wine_tess = tess; gluTessNormal(wine_tess->tess, arg1, arg2, arg3); } + +/*********************************************************************** + * gluBeginPolygon (GLU32.@) + */ +void WINAPI wine_gluBeginPolygon(void *tess) +{ + wine_tess_t *wine_tess = tess; + wine_tess->polygon_data = NULL; + gluTessBeginPolygon(wine_tess->tess, wine_tess); + gluTessBeginContour(wine_tess->tess); +} + +/*********************************************************************** + * gluEndPolygon (GLU32.@) + */ +void WINAPI wine_gluEndPolygon(void *tess) +{ + wine_tess_t *wine_tess = tess; + gluTessEndContour(wine_tess->tess); + gluTessEndPolygon(wine_tess->tess); +} + +/*********************************************************************** + * gluNextContour (GLU32.@) + */ +void WINAPI wine_gluNextContour(void *tess, int arg1) +{ + wine_tess_t *wine_tess = tess; + gluTessEndContour(wine_tess->tess); + gluTessBeginContour(wine_tess->tess); +} -- 2.1.0