Matteo Bruni : wined3d: Don't crash when emulating GL_EXT_fogcoord.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jul 28 13:30:07 CDT 2015


Module: wine
Branch: master
Commit: 6244735f7ab863d912de7c3302ab02fad30bc823
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6244735f7ab863d912de7c3302ab02fad30bc823

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Mon Jul 27 14:29:56 2015 +0200

wined3d: Don't crash when emulating GL_EXT_fogcoord.

---

 dlls/wined3d/gl_compat.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/dlls/wined3d/gl_compat.c b/dlls/wined3d/gl_compat.c
index c79a453..7e6b510 100644
--- a/dlls/wined3d/gl_compat.c
+++ b/dlls/wined3d/gl_compat.c
@@ -264,6 +264,14 @@ static void (WINE_GLAPI *old_fogcoord_glColor4f) (GLfloat r, GLfloat g, GLfloat
 
 static void WINE_GLAPI wine_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
     struct wined3d_context *ctx = context_get_current();
+
+    /* This can be called from draw_test_quad() and at that point there is no
+     * wined3d_context current. */
+    if (!ctx)
+    {
+        old_fogcoord_glVertex4f(x, y, z, w);
+        return;
+    }
     if(ctx->gl_fog_source == GL_FOG_COORDINATE_EXT && ctx->fog_enabled) {
         GLfloat c[4] = {ctx->color[0], ctx->color[1], ctx->color[2], ctx->color[3]};
         GLfloat i;
@@ -294,6 +302,14 @@ static void WINE_GLAPI wine_glVertex3fv(const GLfloat *pos) {
 
 static void WINE_GLAPI wine_glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
     struct wined3d_context *ctx = context_get_current();
+
+    /* This can be called from draw_test_quad() and at that point there is no
+     * wined3d_context current. */
+    if (!ctx)
+    {
+        old_fogcoord_glColor4f(r, g, b, a);
+        return;
+    }
     ctx->color[0] = r;
     ctx->color[1] = g;
     ctx->color[2] = b;




More information about the wine-cvs mailing list