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

Pekka Paalanen <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
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 <[email protected]>
---
 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

--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.