[Mesa-dev] [PATCH 2/4] egl/wayland: handle NULL native_window in create_surface

Emil Velikov emil.l.velikov at gmail.com
Fri Jun 26 05:04:50 PDT 2015


Rise EGL_BAD_NATIVE_WINDOW instead of crashing.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/egl/drivers/dri2/platform_wayland.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 1c98552..052b0e9 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -149,6 +149,11 @@ dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp,
    else
       dri2_surf->format = WL_DRM_FORMAT_ARGB8888;
 
+   if (!window) {
+      _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
+      goto cleanup_surf;
+   }
+
    dri2_surf->wl_win = window;
 
    dri2_surf->wl_win->private = dri2_surf;
-- 
2.4.4



More information about the mesa-dev mailing list