window: check the initial wl_display_dispatch()

Check for errors in the first wl_display_dispatch() call. Otherwise
doing something silly like
  $ WAYLAND_SOCKET=999 ./clickdot
will segfault.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
dev
Pekka Paalanen 12 years ago committed by Kristian Høgsberg
parent 4e1065491b
commit 33a68eaaf4
  1. 7
      clients/window.c

@ -4287,7 +4287,12 @@ display_create(int argc, char *argv[])
d->registry = wl_display_get_registry(d->display);
wl_registry_add_listener(d->registry, &registry_listener, d);
wl_display_dispatch(d->display);
if (wl_display_dispatch(d->display) < 0) {
fprintf(stderr, "Failed to process Wayland connection: %m\n");
return NULL;
}
#ifdef HAVE_CAIRO_EGL
if (init_egl(d) < 0)
fprintf(stderr, "EGL does not seem to work, "

Loading…
Cancel
Save