Mesa (master): egl: Check for null display in handle checking.
Brian Paul
brianp at kemper.freedesktop.org
Fri Aug 21 14:35:23 UTC 2009
Module: Mesa
Branch: master
Commit: 408db29792a2d57409f2604974e4398a3545a38f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=408db29792a2d57409f2604974e4398a3545a38f
Author: Chia-I Wu <olvaffe at gmail.com>
Date: Wed Aug 19 13:00:25 2009 +0800
egl: Check for null display in handle checking.
The display may be NULL when checking a handle.
Signed-off-by: Chia-I Wu <olvaffe at gmail.com>
---
src/egl/main/egldisplay.c | 10 ++++++----
src/egl/main/egldisplay.h | 9 ++++++---
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 30a49a2..9b4227f 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -305,9 +305,10 @@ _eglCheckDisplayHandle(EGLDisplay dpy)
EGLBoolean
_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy)
{
- _EGLContext *cur;
+ _EGLContext *cur = NULL;
- cur = dpy->ContextList;
+ if (dpy)
+ cur = dpy->ContextList;
while (cur) {
if (cur == (_EGLContext *) ctx) {
assert(cur->Display == dpy);
@@ -325,9 +326,10 @@ _eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy)
EGLBoolean
_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy)
{
- _EGLSurface *cur;
+ _EGLSurface *cur = NULL;
- cur = dpy->SurfaceList;
+ if (dpy)
+ cur = dpy->SurfaceList;
while (cur) {
if (cur == (_EGLSurface *) surf) {
assert(cur->Display == dpy);
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 6394c9c..20651e5 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -125,14 +125,17 @@ _eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy);
/* Only do a quick check. This is NOT standard compliant. */
static INLINE EGLBoolean
-_eglCheckDisplayHandle(EGLDisplay dpy) { return EGL_TRUE; }
+_eglCheckDisplayHandle(EGLDisplay dpy)
+{
+ return ((_EGLDisplay *) dpy != NULL);
+}
static INLINE EGLBoolean
_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy)
{
_EGLContext *c = (_EGLContext *) ctx;
- return (c && c->Display == dpy);
+ return (dpy && c && c->Display == dpy);
}
@@ -140,7 +143,7 @@ static INLINE EGLBoolean
_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy)
{
_EGLSurface *s = (_EGLSurface *) surf;
- return (s && s->Display == dpy);
+ return (dpy && s && s->Display == dpy);
}
More information about the mesa-commit
mailing list