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>
This commit is contained in:
parent
76f5ad1784
commit
c6766fe4f4
@ -166,18 +166,31 @@ QWaylandDisplay::~QWaylandDisplay(void)
|
|||||||
|
|
||||||
void QWaylandDisplay::flushRequests()
|
void QWaylandDisplay::flushRequests()
|
||||||
{
|
{
|
||||||
if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) == -1 && (errno == EPIPE || errno == ECONNRESET)) {
|
if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) < 0) {
|
||||||
qWarning("The Wayland connection broke. Did the Wayland compositor die?");
|
int ecode = wl_display_get_error(mDisplay);
|
||||||
|
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");
|
||||||
|
}
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_display_flush(mDisplay);
|
wl_display_flush(mDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QWaylandDisplay::blockingReadEvents()
|
void QWaylandDisplay::blockingReadEvents()
|
||||||
{
|
{
|
||||||
if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1 && (errno == EPIPE || errno == ECONNRESET)) {
|
if (wl_display_dispatch_queue(mDisplay, mEventQueue) < 0) {
|
||||||
qWarning("The Wayland connection broke. Did the Wayland compositor die?");
|
int ecode = wl_display_get_error(mDisplay);
|
||||||
|
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");
|
||||||
|
}
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,14 @@ void QWaylandEventThread::displayConnect()
|
|||||||
|
|
||||||
void QWaylandEventThread::readWaylandEvents()
|
void QWaylandEventThread::readWaylandEvents()
|
||||||
{
|
{
|
||||||
if (wl_display_dispatch(m_display) == -1 && (errno == EPIPE || errno == ECONNRESET)) {
|
if (wl_display_dispatch(m_display) < 0) {
|
||||||
qWarning("The Wayland connection broke. Did the Wayland compositor die?");
|
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");
|
||||||
|
}
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
emit newEventsRead();
|
emit newEventsRead();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user