On 25 August 2016 at 18:06, Kristian Høgsberg <hoegsb...@gmail.com> wrote: > On Thu, Aug 25, 2016 at 9:18 AM, Emil Velikov <emil.l.veli...@gmail.com> > wrote: >> From: Emil Velikov <emil.veli...@collabora.com> >> >> The dri3 version of commits 60e9c35b3a0 and 6de9a03bed4. >> >> CC: <mesa-sta...@lists.freedesktop.org> >> Signed-off-by: Emil Velikov <emil.veli...@collabora.com> >> --- >> src/egl/drivers/dri2/platform_x11.c | 14 +++++--------- >> 1 file changed, 5 insertions(+), 9 deletions(-) >> >> diff --git a/src/egl/drivers/dri2/platform_x11.c >> b/src/egl/drivers/dri2/platform_x11.c >> index 2a5fc0b..ede12b6 100644 >> --- a/src/egl/drivers/dri2/platform_x11.c >> +++ b/src/egl/drivers/dri2/platform_x11.c >> @@ -1313,15 +1313,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; >> } > > When is dri2_dpy->conn ever NULL? xcb_connect() returns a valid > connection or an error object, and I don't see how XGetXCBConnection() > would ever return a NULL connection either. > It's been a while since I looked into these... - xcb_connect's man page is perfectly clear. Does not return NULL, even on failure. - XGetXCBConnection's one is pretty quiet. Looking at the XCB wiki [1] there is a NULL check, which (IMHO) is due to the fact that one cannot guarantee xcb_connect-like behaviour.
That said I'm inclined to keep the patch as-is, regardless of how (un)likely it is to trigger. Thanks Emil [1] https://xcb.freedesktop.org/MixingCalls _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev