diff options
author | Chia-I Wu <[email protected]> | 2009-08-20 19:35:28 +0800 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-08-21 08:34:34 -0600 |
commit | 1f871a4d1536a7124d82d4503d1167bd668f84da (patch) | |
tree | 3969d2add2e35df2a17fd0c350429b940eff3fd1 /src/gallium | |
parent | 408db29792a2d57409f2604974e4398a3545a38f (diff) |
egl_softpipe: Do not flush unlinked context.
An unlinked context is destroyed after _eglMakeCurrent. Flushing such
context would cause segfault.
Signed-off-by: Chia-I Wu <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/winsys/egl_xlib/egl_xlib.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gallium/winsys/egl_xlib/egl_xlib.c b/src/gallium/winsys/egl_xlib/egl_xlib.c index 1fcdd2dceb0..96f460f88a9 100644 --- a/src/gallium/winsys/egl_xlib/egl_xlib.c +++ b/src/gallium/winsys/egl_xlib/egl_xlib.c @@ -424,14 +424,19 @@ xlib_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, struct xlib_egl_context *context = lookup_context(ctx); struct xlib_egl_surface *draw_surf = lookup_surface(draw); struct xlib_egl_surface *read_surf = lookup_surface(read); - struct st_context *oldctx = st_get_current(); + struct st_context *oldcontext = NULL; + _EGLContext *oldctx; + + oldctx = _eglGetCurrentContext(); + if (oldctx && _eglIsContextLinked(oldctx)) + oldcontext = st_get_current(); if (!_eglMakeCurrent(drv, dpy, draw, read, ctx)) return EGL_FALSE; /* Flush before switching context. Check client API? */ - if (oldctx) - st_flush(oldctx, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL); + if (oldcontext) + st_flush(oldcontext, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL); st_make_current((context ? context->Context : NULL), (draw_surf ? draw_surf->Framebuffer : NULL), (read_surf ? read_surf->Framebuffer : NULL)); |