devilhorns pushed a commit to branch master.

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

commit e2944780fad775de31f99fc8dd6d93528bbdc7ae
Author: Hosang Kim <hosang12....@samsung.com>
Date:   Wed Aug 19 11:50:31 2020 +0000

    ecore_wl2_display: move wl_display_dispatch_pending before condition check.
    
    Sometimes display ref count is not zero after wl_display_dispatch_pending.
    
    For example, wl_data_source_listener's callback is called by 
wl_display_dispatch_pending.
    Display ref count is not zero but display is cleaned up, it makes double 
free corruption.
    
    Reviewed-by: Christopher Michael <devilho...@comcast.net>
    Differential Revision: https://phab.enlightenment.org/D12109
---
 src/lib/ecore_wl2/ecore_wl2_display.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c 
b/src/lib/ecore_wl2/ecore_wl2_display.c
index a91285e466..7344cf8b74 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -965,17 +965,16 @@ EAPI void
 ecore_wl2_display_disconnect(Ecore_Wl2_Display *display)
 {
    EINA_SAFETY_ON_NULL_RETURN(display);
+   int ret;
+
+   do
+     {
+        ret = wl_display_dispatch_pending(display->wl.display);
+     } while (ret > 0);
 
    --display->refs;
    if (display->refs == 0)
      {
-        int ret;
-
-        do
-          {
-             ret = wl_display_dispatch_pending(display->wl.display);
-          } while (ret > 0);
-
         _ecore_wl2_display_cleanup(display);
 
         wl_display_disconnect(display->wl.display);

-- 


Reply via email to