summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/egl/drivers/dri2/platform_x11.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 459c3914ad..bf7d2bea4c 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -289,7 +289,25 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
}
if (dri2_dpy->dri2) {
- xcb_dri2_create_drawable (dri2_dpy->conn, dri2_surf->drawable);
+ xcb_void_cookie_t cookie;
+ int conn_error;
+
+ cookie = xcb_dri2_create_drawable_checked(dri2_dpy->conn,
+ dri2_surf->drawable);
+ error = xcb_request_check(dri2_dpy->conn, cookie);
+ conn_error = xcb_connection_has_error(dri2_dpy->conn);
+ if (conn_error || error != NULL) {
+ if (type == EGL_PBUFFER_BIT || conn_error || error->error_code == BadAlloc)
+ _eglError(EGL_BAD_ALLOC, "xcb_dri2_create_drawable_checked");
+ else if (type == EGL_WINDOW_BIT)
+ _eglError(EGL_BAD_NATIVE_WINDOW,
+ "xcb_dri2_create_drawable_checked");
+ else
+ _eglError(EGL_BAD_NATIVE_PIXMAP,
+ "xcb_dri2_create_drawable_checked");
+ free(error);
+ goto cleanup_dri_drawable;
+ }
} else {
if (type == EGL_PBUFFER_BIT) {
dri2_surf->depth = _eglGetConfigKey(conf, EGL_BUFFER_SIZE);