cedric pushed a commit to branch master.

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

commit 48b8118123aefe69ecb2d93f0787dd7a021814ad
Author: Cedric Bail <ced...@osg.samsung.com>
Date:   Sat May 12 22:09:37 2018 -0700

    eo: update refcount before sending efl_noref event to avoid double update 
during events propagation.
---
 src/lib/eo/eo.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 74467ddebc..32d044ebeb 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -1894,8 +1894,10 @@ efl_unref(const Eo *obj_id)
         return ;
      }
 
-   if (EINA_UNLIKELY((obj->user_refcount == 1 && !obj->parent) ||
-                     (obj->user_refcount == 2 && obj->parent)))
+   --(obj->user_refcount);
+
+   if (EINA_UNLIKELY((obj->user_refcount == 0 && !obj->parent) ||
+                     (obj->user_refcount == 1 && obj->parent)))
      {
         // The noref event should happen before any object in the
         // tree get affected by the change in refcount.
@@ -1903,7 +1905,6 @@ efl_unref(const Eo *obj_id)
         efl_noref((Eo *) obj_id);
      }
 
-   --(obj->user_refcount);
 #ifdef EO_DEBUG
    _eo_log_obj_ref_op(obj, EO_REF_OP_UNREF);
 #endif

-- 


Reply via email to