From 1016fb64de716587f12997cf48bcfb739b4c5bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 9 Dec 2014 20:13:39 +0100 Subject: [PATCH] mir: return proper surface / connection only when valid, without failing --- cogl/winsys/cogl-winsys-egl-mir.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cogl/winsys/cogl-winsys-egl-mir.c b/cogl/winsys/cogl-winsys-egl-mir.c index 86c30a3f3..bc6b6bcf7 100644 --- a/cogl/winsys/cogl-winsys-egl-mir.c +++ b/cogl/winsys/cogl-winsys-egl-mir.c @@ -691,7 +691,9 @@ cogl_mir_renderer_get_connection (CoglRenderer *renderer) { CoglRendererEGL *egl_renderer = renderer->winsys; CoglRendererMir *mir_renderer = egl_renderer->platform; - return mir_renderer->mir_connection; + + if (mir_connection_is_valid (mir_renderer->mir_connection)) + return mir_renderer->mir_connection; } return NULL; @@ -729,9 +731,10 @@ cogl_mir_onscreen_get_surface (CoglOnscreen *onscreen) egl_onscreen = onscreen->winsys; mir_onscreen = egl_onscreen->platform; - _COGL_RETURN_VAL_IF_FAIL (mir_surface_is_valid (mir_onscreen->mir_surface), NULL); + if (mir_surface_is_valid (mir_onscreen->mir_surface)) + return mir_onscreen->mir_surface; - return mir_onscreen->mir_surface; + return NULL; } void