Mesa (mesa_7_5_branch): mesa: Check/ propagate return value on st_make_current.
Jose Fonseca
jrfonseca at kemper.freedesktop.org
Sun May 31 03:29:35 UTC 2009
Module: Mesa
Branch: mesa_7_5_branch
Commit: 8aef306c342a973f31b384a71d7a22ade9153a99
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8aef306c342a973f31b384a71d7a22ade9153a99
Author: José Fonseca <jfonseca at vmware.com>
Date: Sat May 30 12:41:14 2009 -0700
mesa: Check/propagate return value on st_make_current.
Prevents segmentation fault when trying to set the viewport/scissor
after a context/drawable visual mismatch.
---
src/mesa/state_tracker/st_context.c | 13 ++++++++-----
src/mesa/state_tracker/st_public.h | 6 +++---
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index e536029..92ddffc 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -263,9 +263,10 @@ void st_destroy_context( struct st_context *st )
}
-void st_make_current(struct st_context *st,
- struct st_framebuffer *draw,
- struct st_framebuffer *read)
+GLboolean
+st_make_current(struct st_context *st,
+ struct st_framebuffer *draw,
+ struct st_framebuffer *read)
{
/* Call this periodically to detect when the user has begun using
* GL rendering from multiple threads.
@@ -274,7 +275,8 @@ void st_make_current(struct st_context *st,
if (st) {
GLboolean firstTime = st->ctx->FirstTimeCurrent;
- _mesa_make_current(st->ctx, &draw->Base, &read->Base);
+ if(!_mesa_make_current(st->ctx, &draw->Base, &read->Base))
+ return GL_FALSE;
/* Need to initialize viewport here since draw->Base->Width/Height
* will still be zero at this point.
* This could be improved, but would require rather extensive work
@@ -286,9 +288,10 @@ void st_make_current(struct st_context *st,
_mesa_set_scissor(st->ctx, 0, 0, w, h);
}
+ return GL_TRUE;
}
else {
- _mesa_make_current(NULL, NULL, NULL);
+ return _mesa_make_current(NULL, NULL, NULL);
}
}
diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h
index 290b8a9..c411687 100644
--- a/src/mesa/state_tracker/st_public.h
+++ b/src/mesa/state_tracker/st_public.h
@@ -91,9 +91,9 @@ void *st_framebuffer_private( struct st_framebuffer *stfb );
void st_unreference_framebuffer( struct st_framebuffer *stfb );
-void st_make_current(struct st_context *st,
- struct st_framebuffer *draw,
- struct st_framebuffer *read);
+GLboolean st_make_current(struct st_context *st,
+ struct st_framebuffer *draw,
+ struct st_framebuffer *read);
struct st_context *st_get_current(void);
More information about the mesa-commit
mailing list