forked from enlightenment/efl
ecore_wl: abort if wl_display_dispatch returns negative value
Summary: If the connection between server and client has problems, wl_display_dispatch an return negative value. i.e. when enlightenment has been killed accidently. In this case, app can enter into infinite loop. Signed-off-by: Boram Park <boram1288.park@samsung.com> Reviewers: stefan_schmidt, zmike, gwanglim, raster, devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3077
This commit is contained in:
parent
f823d9c2cc
commit
3ebdfd8779
|
@ -121,8 +121,18 @@ _ecore_wl_init_callback(void *data, struct wl_callback *callback, uint32_t seria
|
||||||
static void
|
static void
|
||||||
_ecore_wl_init_wait(void)
|
_ecore_wl_init_wait(void)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
while (!_ecore_wl_disp->init_done)
|
while (!_ecore_wl_disp->init_done)
|
||||||
wl_display_dispatch(_ecore_wl_disp->wl.display);
|
{
|
||||||
|
ret = wl_display_dispatch(_ecore_wl_disp->wl.display);
|
||||||
|
if ((ret < 0) && ((errno != EAGAIN) && (errno != EINVAL)))
|
||||||
|
{
|
||||||
|
/* raise exit signal */
|
||||||
|
ERR("Wayland socket error: %s", strerror(errno));
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
|
@ -262,10 +272,20 @@ ecore_wl_flush(void)
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_wl_sync(void)
|
ecore_wl_sync(void)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) return;
|
if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) return;
|
||||||
_ecore_wl_sync_wait(_ecore_wl_disp);
|
_ecore_wl_sync_wait(_ecore_wl_disp);
|
||||||
while (_ecore_wl_disp->sync_ref_count > 0)
|
while (_ecore_wl_disp->sync_ref_count > 0)
|
||||||
wl_display_dispatch(_ecore_wl_disp->wl.display);
|
{
|
||||||
|
ret = wl_display_dispatch(_ecore_wl_disp->wl.display);
|
||||||
|
if ((ret < 0) && ((errno != EAGAIN) && (errno != EINVAL)))
|
||||||
|
{
|
||||||
|
/* raise exit signal */
|
||||||
|
ERR("Wayland socket error: %s", strerror(errno));
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI struct wl_shm *
|
EAPI struct wl_shm *
|
||||||
|
@ -407,9 +427,18 @@ ecore_wl_dpi_get(void)
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_wl_display_iterate(void)
|
ecore_wl_display_iterate(void)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) return;
|
if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) return;
|
||||||
if (!_ecore_wl_server_mode)
|
if (!_ecore_wl_server_mode)
|
||||||
wl_display_dispatch(_ecore_wl_disp->wl.display);
|
{
|
||||||
|
ret = wl_display_dispatch(_ecore_wl_disp->wl.display);
|
||||||
|
if ((ret < 0) && ((errno != EAGAIN) && (errno != EINVAL)))
|
||||||
|
{
|
||||||
|
/* raise exit signal */
|
||||||
|
ERR("Wayland socket error: %s", strerror(errno));
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @since 1.8 */
|
/* @since 1.8 */
|
||||||
|
|
Loading…
Reference in New Issue