devilhorns pushed a commit to branch master.

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

commit c6b59be1da0bf9a3c667f63e82ec4a2ad64f0e9e
Author: Chris Michael <cp.mich...@samsung.com>
Date:   Wed Mar 1 08:32:18 2017 -0500

    ecore-wl2: Ensure display cleanup after roundtrips
    
    Commit ee52a28d041dfb02da0f2deca0714beb5eaa51fd added a roundtrip to
    ensure and pending wl events were handled before we disconnected the
    display. While this ensures some things like session recovery destroy
    work again, it lead to an issue where the _ecore_wl2_display_cleanup
    function was called BEFORE we processed pending events. This (in turn)
    causes crashes due to processing of pending events that relied on
    things like Ecore_Wl2_Input existing. As the display cleanup function
    clears inputs & outputs, we need to defer calling that until the
    display_roundtrip has dispatched and handled pending events.
    
    @fix
    
    Signed-off-by: Chris Michael <cp.mich...@samsung.com>
---
 src/lib/ecore_wl2/ecore_wl2_display.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c 
b/src/lib/ecore_wl2/ecore_wl2_display.c
index c38e383..232bbfd 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -564,8 +564,6 @@ _ecore_wl2_display_cleanup(Ecore_Wl2_Display *ewd)
    Ecore_Wl2_Input *input;
    Eina_Inlist *tmp;
 
-   if (--ewd->refs) return;
-
    if (ewd->xkb_context) xkb_context_unref(ewd->xkb_context);
 
    /* free each input */
@@ -809,7 +807,7 @@ ecore_wl2_display_disconnect(Ecore_Wl2_Display *display)
 {
    EINA_SAFETY_ON_NULL_RETURN(display);
 
-   _ecore_wl2_display_cleanup(display);
+   --display->refs;
    if (display->refs == 0)
      {
         wl_display_roundtrip(display->wl.display);
@@ -818,6 +816,8 @@ ecore_wl2_display_disconnect(Ecore_Wl2_Display *display)
         /* remove this client display from hash */
         eina_hash_del_by_key(_client_displays, display->name);
 
+        _ecore_wl2_display_cleanup(display);
+
         free(display->name);
         free(display);
      }
@@ -828,9 +828,13 @@ ecore_wl2_display_destroy(Ecore_Wl2_Display *display)
 {
    EINA_SAFETY_ON_NULL_RETURN(display);
 
-   _ecore_wl2_display_cleanup(display);
+   --display->refs;
    if (display->refs == 0)
      {
+        /* this ensures that things like wl_registry are destroyed
+         * before we destroy the actual wl_display */
+        _ecore_wl2_display_cleanup(display);
+
         wl_display_destroy(display->wl.display);
 
         /* remove this client display from hash */

-- 


Reply via email to