Ulrich Czekalla : winex11.drv: Don'
t crash when called with a NULL gl context.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Dec 20 08:54:53 CST 2006
Module: wine
Branch: master
Commit: b2f33ffbbb342b0e03ed1a26239946de1808c73d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b2f33ffbbb342b0e03ed1a26239946de1808c73d
Author: Ulrich Czekalla <ulrich.czekalla at utoronto.ca>
Date: Tue Dec 19 11:02:56 2006 -0500
winex11.drv: Don't crash when called with a NULL gl context.
---
dlls/winex11.drv/opengl.c | 40 ++++++++++++++++++++++++++--------------
1 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 07e076d..418067a 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1795,7 +1795,9 @@ static void WINAPI X11DRV_wglDisable(GLe
if (cap == GL_SCISSOR_TEST)
{
Wine_GLContext *ctx = (Wine_GLContext *) NtCurrentTeb()->glContext;
- ctx->scissor_enabled = FALSE;
+
+ if (ctx)
+ ctx->scissor_enabled = FALSE;
}
else
{
@@ -1810,7 +1812,9 @@ static void WINAPI X11DRV_wglEnable(GLen
if (cap == GL_SCISSOR_TEST)
{
Wine_GLContext *ctx = (Wine_GLContext *) NtCurrentTeb()->glContext;
- ctx->scissor_enabled = TRUE;
+
+ if (ctx)
+ ctx->scissor_enabled = TRUE;
}
else
{
@@ -1861,12 +1865,14 @@ static void WINAPI X11DRV_wglGetIntegerv
static GLboolean WINAPI X11DRV_wglIsEnabled(GLenum cap)
{
- GLboolean enabled;
+ GLboolean enabled = False;
if (cap == GL_SCISSOR_TEST)
{
Wine_GLContext *ctx = (Wine_GLContext *) NtCurrentTeb()->glContext;
- enabled = ctx->scissor_enabled;
+
+ if (ctx)
+ enabled = ctx->scissor_enabled;
}
else
{
@@ -1881,24 +1887,30 @@ static void WINAPI X11DRV_wglScissor(GLi
{
Wine_GLContext *ctx = (Wine_GLContext *) NtCurrentTeb()->glContext;
- ctx->scissor.left = x;
- ctx->scissor.top = y;
- ctx->scissor.right = x + width;
- ctx->scissor.bottom = y + height;
+ if (ctx)
+ {
+ ctx->scissor.left = x;
+ ctx->scissor.top = y;
+ ctx->scissor.right = x + width;
+ ctx->scissor.bottom = y + height;
- sync_current_drawable(TRUE);
+ sync_current_drawable(TRUE);
+ }
}
static void WINAPI X11DRV_wglViewport(GLint x, GLint y, GLsizei width, GLsizei height)
{
Wine_GLContext *ctx = (Wine_GLContext *) NtCurrentTeb()->glContext;
- ctx->viewport.left = x;
- ctx->viewport.top = y;
- ctx->viewport.right = x + width;
- ctx->viewport.bottom = y + height;
+ if (ctx)
+ {
+ ctx->viewport.left = x;
+ ctx->viewport.top = y;
+ ctx->viewport.right = x + width;
+ ctx->viewport.bottom = y + height;
- sync_current_drawable(TRUE);
+ sync_current_drawable(TRUE);
+ }
}
/**
More information about the wine-cvs
mailing list