derekf pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=74283f076eb9f94f33b03bdf1de756999cc18237

commit 74283f076eb9f94f33b03bdf1de756999cc18237
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Tue May 3 13:52:03 2016 -0500

    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 <cpmich...@osg.samsung.com>
---
 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 75ddd46..ccc4a8b 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:

-- 


Reply via email to