aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2016-08-24 23:57:16 +0100
committerEmil Velikov <[email protected]>2016-10-14 12:42:37 +0100
commitb10c05d4ffaf67786b48b978871e1015b3840653 (patch)
treef7b79b8b738021ee4aa8849dd37b55323487de70 /src
parentf871946594129500a67c05a6d9fe99db54b4bb64 (diff)
egl/x11: don't crash if dri2_dpy->conn is NULL
The dri3 version of commits 60e9c35b3a0 and 6de9a03bed4. While using xcb_connect() guarantees that we always get a non NULL return value, XGetXCBConnection() does/can not. CC: <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/egl/drivers/dri2/platform_x11.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 296ddb333b2..c27f289459d 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -1312,15 +1312,13 @@ dri2_initialize_x11_dri3(_EGLDriver *drv, _EGLDisplay *disp)
dri2_dpy->screen = DefaultScreen(dpy);
}
- if (xcb_connection_has_error(dri2_dpy->conn)) {
+ if (!dri2_dpy->conn || xcb_connection_has_error(dri2_dpy->conn)) {
_eglLog(_EGL_WARNING, "DRI3: xcb_connect failed");
goto cleanup_dpy;
}
- if (dri2_dpy->conn) {
- if (!dri3_x11_connect(dri2_dpy))
- goto cleanup_conn;
- }
+ if (!dri3_x11_connect(dri2_dpy))
+ goto cleanup_conn;
if (!dri2_load_driver_dri3(disp))
goto cleanup_conn;
@@ -1346,10 +1344,8 @@ dri2_initialize_x11_dri3(_EGLDriver *drv, _EGLDisplay *disp)
disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
#endif
- if (dri2_dpy->conn) {
- if (!dri2_x11_add_configs_for_visuals(dri2_dpy, disp, false))
- goto cleanup_configs;
- }
+ if (!dri2_x11_add_configs_for_visuals(dri2_dpy, disp, false))
+ goto cleanup_configs;
dri2_dpy->loader_dri3_ext.core = dri2_dpy->core;
dri2_dpy->loader_dri3_ext.image_driver = dri2_dpy->image_driver;