From 74283f076eb9f94f33b03bdf1de756999cc18237 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Tue, 3 May 2016 13:52:03 -0500 Subject: [PATCH] ecore_wl2: Check return of wl_display_dispatch() If the compositor crashes at just the right time this dispatch can fail and result in a stuck app spinning in a tight loop. Fix it so we do a proper shutdown in this case. Signed-off-by: Chris Michael --- src/lib/ecore_wl2/ecore_wl2_display.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c index 75ddd466a8..ccc4a8bcbb 100644 --- a/src/lib/ecore_wl2/ecore_wl2_display.c +++ b/src/lib/ecore_wl2/ecore_wl2_display.c @@ -615,9 +615,6 @@ ecore_wl2_display_connect(const char *name) ewd->xkb_context = xkb_context_new(0); if (!ewd->xkb_context) goto context_err; - /* add this new client display to hash */ - eina_hash_add(_client_displays, ewd->name, ewd); - /* check server display hash and match on pid. If match, skip sync */ sync = _ecore_wl2_display_sync_get(); @@ -631,9 +628,25 @@ ecore_wl2_display_connect(const char *name) * other option here as we need the compositor, shell, etc, to be setup * before we can allow a user to make use of the API functions */ while (!ewd->sync_done) - wl_display_dispatch(ewd->wl.display); + { + int ret; + + ret = wl_display_dispatch(ewd->wl.display); + if ((ret < 0) && (errno != EAGAIN)) + { + ERR("Received Fatal Error on Wayland Display"); + + _fatal_error = EINA_TRUE; + _ecore_wl2_display_signal_exit(); + + goto context_err; + } + } } + /* add this new client display to hash */ + eina_hash_add(_client_displays, ewd->name, ewd); + return ewd; context_err: