aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/wgl
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-02-16 12:20:57 -0700
committerBrian Paul <[email protected]>2012-02-23 07:49:08 -0700
commitbe05388ce983face72ca17241f0f2e154c11f435 (patch)
treeea67b62b7c73fa88a9bb90fb8c05fb2110985822 /src/gallium/state_trackers/wgl
parent9ffc8ea8f4cfa15115a93039cc7099f0fd597fe3 (diff)
st/wgl: check for hPbuffer=0 in wgl pbuffer functions
Per the GL_WGL_pbuffer spec, generate ERROR_INVALID_HANDLE and return FALSE (and don't segfault). Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/wgl')
-rw-r--r--src/gallium/state_trackers/wgl/stw_ext_pbuffer.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
index 085591a5560..7596cb6bd95 100644
--- a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
@@ -239,6 +239,11 @@ wglGetPbufferDCARB(HPBUFFERARB hPbuffer)
struct stw_framebuffer *fb;
HDC hDC;
+ if (!hPbuffer) {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return NULL;
+ }
+
fb = (struct stw_framebuffer *)hPbuffer;
hDC = GetDC(fb->hWnd);
@@ -255,6 +260,11 @@ wglReleasePbufferDCARB(HPBUFFERARB hPbuffer,
{
struct stw_framebuffer *fb;
+ if (!hPbuffer) {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return 0;
+ }
+
fb = (struct stw_framebuffer *)hPbuffer;
return ReleaseDC(fb->hWnd, hDC);
@@ -266,6 +276,11 @@ wglDestroyPbufferARB(HPBUFFERARB hPbuffer)
{
struct stw_framebuffer *fb;
+ if (!hPbuffer) {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+
fb = (struct stw_framebuffer *)hPbuffer;
/* This will destroy all our data */
@@ -280,6 +295,11 @@ wglQueryPbufferARB(HPBUFFERARB hPbuffer,
{
struct stw_framebuffer *fb;
+ if (!hPbuffer) {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+
fb = (struct stw_framebuffer *)hPbuffer;
switch (iAttribute) {