Avoid crashing race condition.

Change-Id: I940bcbc509a689804a02f71af45f5efc19bccf9f
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Always bail out when the compositor is closed

errno can both be EPIPE and ECONNRESET when reading from the connection
after the server is closed.

Change-Id: I03b64a382db3de66819277e9955aeca3e2d7f9a1
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
QWaylandDisplay: Correctly intercept all errors when dispatching.

A connection reset isn't the only form of error we may run into, so make sure we
check for other exceptional circumstances through wl_display_get_error.

This fixes my case of e.g. wl_drm throwing an error but QtWayland never
quitting the client.

Change-Id: I8c76dd7913640e58d03bd2fe52eb054a4daa0235
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
QWaylandDisplay: Centralize error handling in one place.

Change-Id: Ifba23e349a4006cea501480a7230408f0fafd1b7
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Call ::exit() from the gui thread only

::exit() is not thread safe, so make sure to not call it more than one
time, once from the gui thread and once from the wayland event thread.

Change-Id: I80905c6d996cb827a5101ae6d6c9bc12a267ba71
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Merge pull request #1 from nizovn/bug613

Fix bug #613