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 <cpmichael@osg.samsung.com>
This commit is contained in:
Derek Foreman 2016-05-03 13:52:03 -05:00
parent d6818131c0
commit 74283f076e
1 changed files with 17 additions and 4 deletions

View File

@ -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: