[cairo] [PATCH] egl: do not destroy dummy_surface if it does not exist

Pekka Paalanen ppaalanen at gmail.com
Fri Dec 16 06:27:40 PST 2011


On deleting an EGL device, it is possible that
cairo_egl_context_t::dummy_surface is EGL_NO_SURFACE. In that case
calling eglDestroySurface() on it will lead to EGL_BAD_SURFACE error.

Check dummy_surface before destroying it.

Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
 src/cairo-egl-context.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/cairo-egl-context.c b/src/cairo-egl-context.c
index ec23852..c280519 100644
--- a/src/cairo-egl-context.c
+++ b/src/cairo-egl-context.c
@@ -112,7 +112,8 @@ _egl_destroy (void *abstract_ctx)
 
     eglMakeCurrent (ctx->display,
 		    EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
-    eglDestroySurface (ctx->display, ctx->dummy_surface);
+    if (ctx->dummy_surface != EGL_NO_SURFACE)
+        eglDestroySurface (ctx->display, ctx->dummy_surface);
 }
 
 static cairo_bool_t
-- 
1.7.3.4



More information about the cairo mailing list