eo: Allow efl_reuse to be called with a parent
authorJean-Philippe Andre <jp.andre@samsung.com>
Thu, 28 Sep 2017 06:43:28 +0000 (15:43 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Thu, 28 Sep 2017 07:10:53 +0000 (16:10 +0900)
If an object still has a parent inside the del intercept, we shouldn't
reset the "parent_sunk" flag. This would indeed break logic as
parent_sunk == false implies that a parent was never set, which means
the parent must be null. Right now this case isn't used but it can be
imagined with caches of evas objects (they should remain parented to
their evas).

@fix

src/lib/eo/eo.c

index 49dc221..9a65b20 100644 (file)
@@ -1028,13 +1028,17 @@ EAPI void
 efl_reuse(const Eo *eo_id)
 {
    Eo *obj = (Eo *) eo_id;
+   EO_OBJ_POINTER_RETURN(obj, _obj);
+
    efl_object_override(obj, NULL);
-   _efl_object_parent_sink_set(obj, EINA_FALSE);
+   if (!efl_parent_get(obj))
+     _efl_object_parent_sink_set(obj, EINA_FALSE);
+
 #ifdef EO_DEBUG
-   EO_OBJ_POINTER_RETURN(eo_id, _obj);
    _eo_log_obj_ref_op(_obj, EO_REF_OP_REUSE);
-   EO_OBJ_DONE(eo_id);
 #endif
+
+   EO_OBJ_DONE(eo_id);
 }
 
 void