// ### be careful what you do, this function may also be called from other // threads to clean up & exit. void QWaylandEventThread::checkError() const { int ecode = wl_display_get_error(m_display); if ((ecode == EPIPE || ecode == ECONNRESET)) { // special case this to provide a nicer error qWarning("The Wayland connection broke. Did the Wayland compositor die?"); } else { qErrnoWarning(ecode, "The Wayland connection experienced a fatal error"); } }
static void check_fatal_error(struct wl_display *display) { int error = wl_display_get_error(display); if (error == 0) return; fprintf(stderr, "Wayland display got fatal error %i: %s\n", error, strerror(error)); if (errno != 0) fprintf(stderr, "Additionally, errno was set to %i: %s\n", errno, strerror(errno)); fprintf(stderr, "The display is now unusable, aborting.\n"); abort(); }
static void leak_after_error(void) { struct client *c = client_connect(); /* this should return -1, because we'll send error * from server. */ assert(stop_display(c, 1) == -1); assert(wl_display_dispatch_pending(c->wl_display) == -1); assert(wl_display_get_error(c->wl_display) == ENOMEM); /* after we got error, we have display_resume event * in the queue. It should be freed in wl_display_disconnect(). * Let's see! */ wl_proxy_destroy((struct wl_proxy *) c->tc); wl_display_disconnect(c->wl_display); free(c); }
static bool DisplayError(vlc_object_t *obj, struct wl_display *display) { int val = wl_display_get_error(display); if (val == 0) return false; if (val == EPROTO) { const struct wl_interface *iface; uint32_t id; val = wl_display_get_protocol_error(display, &iface, &id); msg_Err(obj, "display protocol error %d on %s object %"PRIu32, val, iface->name, id); } else msg_Err(obj, "display fatal error: %s", vlc_strerror_c(val)); return true; }
void wit_client_free(struct wit_client *c) { assertf(c, "Wrong pointer"); /* do everything what left */ wl_display_roundtrip(c->display); assertf(wl_display_get_error(c->display) == 0, "An error in display occured"); client_object_destroy(&c->compositor, (void *) &wl_compositor_destroy); client_object_destroy(&c->seat, (void *) &wl_seat_destroy); client_object_destroy(&c->pointer, (void *) &wl_pointer_destroy); client_object_destroy(&c->keyboard, (void *) &wl_keyboard_destroy); client_object_destroy(&c->touch, (void *) &wl_touch_destroy); client_object_destroy(&c->registry, (void *) &wl_registry_destroy); wl_display_disconnect(c->display); close(c->sock); free(c); }
struct wit_client * wit_client_populate(int sock) { struct wit_client *c = calloc(1, sizeof *c); assert(c && "Out of memory"); c->sock = sock; c->display = wl_display_connect(NULL); assertf(c->display, "Couldn't connect to display"); c->registry.proxy = (struct wl_proxy *) wl_display_get_registry(c->display); assertf(c->registry.proxy, "Couldn't get registry"); wit_client_add_listener(c, "wl_registry", ®istry_default_listener); wl_display_dispatch(c->display); assertf(wl_display_get_error(c->display) == 0, "An error in display occured"); return c; }
int GetError(){ return wl_display_get_error(cobj); }