summaryrefslogtreecommitdiff
path: root/src/egl/main/eglcontext.c
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2010-01-27 23:51:54 +0800
committerChia-I Wu <olvaffe@gmail.com>2010-01-28 17:28:47 +0800
commit17330479b39409a63a06ec9e6b0f8e28b585db12 (patch)
tree699ae386d4ed799d26b90caeb2566ce1ba072b0e /src/egl/main/eglcontext.c
parent959481ad70b033a254f4d7d0a94dfdfab6b94c15 (diff)
egl: eglMakeCurrent should accept an uninitialized display.
When no context or surface are given, the display is allowed to be uninitialized. Most drivers cannot handle an uninitialized display. But they are updated to at least throw a fatal message.
Diffstat (limited to 'src/egl/main/eglcontext.c')
-rw-r--r--src/egl/main/eglcontext.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index 4a9a47204c..60d2efd44b 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -321,16 +321,19 @@ _eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw,
if (!_eglBindContext(&ctx, &draw, &read))
return EGL_FALSE;
- /* avoid double destroy */
- if (read && read == draw)
- read = NULL;
-
- if (ctx && !_eglIsContextLinked(ctx))
- drv->API.DestroyContext(drv, dpy, ctx);
- if (draw && !_eglIsSurfaceLinked(draw))
- drv->API.DestroySurface(drv, dpy, draw);
- if (read && !_eglIsSurfaceLinked(read))
- drv->API.DestroySurface(drv, dpy, read);
+ /* nothing we can do if the display is uninitialized */
+ if (dpy->Initialized) {
+ /* avoid double destroy */
+ if (read && read == draw)
+ read = NULL;
+
+ if (ctx && !_eglIsContextLinked(ctx))
+ drv->API.DestroyContext(drv, dpy, ctx);
+ if (draw && !_eglIsSurfaceLinked(draw))
+ drv->API.DestroySurface(drv, dpy, draw);
+ if (read && !_eglIsSurfaceLinked(read))
+ drv->API.DestroySurface(drv, dpy, read);
+ }
return EGL_TRUE;
}