summaryrefslogtreecommitdiff
path: root/src/lib/eo/eo_base_class.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2018-05-01 13:32:12 -0700
committerCedric BAIL <cedric@osg.samsung.com>2018-05-24 16:02:18 -0700
commit2160fe0d4d6fe9dd13527f32cd357ce87ec56fda (patch)
treece7262e11da45f1f3f7f9be60ec0afd9f789dad2 /src/lib/eo/eo_base_class.c
parent266dabc0965c3920bf6681205c776e5ade0a9704 (diff)
eo: invalidate at the end of efl_invalidate only and prevent infinite recursion with an invalidating phase.
Differential Revision: https://phab.enlightenment.org/D6075
Diffstat (limited to 'src/lib/eo/eo_base_class.c')
-rw-r--r--src/lib/eo/eo_base_class.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index 5d21a42..963564a 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -65,7 +65,6 @@ typedef struct
65 Eina_Bool parent_sunk : 1; // If parent ref has already been settled (parent has been set, or we are in add_ref mode 65 Eina_Bool parent_sunk : 1; // If parent ref has already been settled (parent has been set, or we are in add_ref mode
66 Eina_Bool allow_parent_unref : 1; // Allows unref to zero even with a parent 66 Eina_Bool allow_parent_unref : 1; // Allows unref to zero even with a parent
67 Eina_Bool has_destroyed_event_cb : 1; // No proper count: minor optimization triggered at destruction only 67 Eina_Bool has_destroyed_event_cb : 1; // No proper count: minor optimization triggered at destruction only
68 Eina_Bool invalidate : 1; // Object become invalide once it loose its parent
69} Efl_Object_Data; 68} Efl_Object_Data;
70 69
71typedef enum 70typedef enum
@@ -666,6 +665,7 @@ void
666_efl_object_reuse(Eo *obj_id) 665_efl_object_reuse(Eo *obj_id)
667{ 666{
668 EO_OBJ_POINTER(obj_id, obj); 667 EO_OBJ_POINTER(obj_id, obj);
668 obj->is_invalidating = EINA_FALSE;
669 obj->invalidate = EINA_FALSE; 669 obj->invalidate = EINA_FALSE;
670 EO_OBJ_DONE(obj_id); 670 EO_OBJ_DONE(obj_id);
671} 671}
@@ -680,8 +680,13 @@ _efl_object_parent_set(Eo *obj, Efl_Object_Data *pd, Eo *parent_id)
680 680
681 EO_OBJ_POINTER_GOTO(obj, eo_obj, err_impossible); 681 EO_OBJ_POINTER_GOTO(obj, eo_obj, err_impossible);
682 682
683 if (eo_obj->is_invalidating && parent_id == NULL)
684 {
685 EO_OBJ_DONE(obj);
686 return ;
687 }
683 // Invalidated object can not be bring back to life 688 // Invalidated object can not be bring back to life
684 if (eo_obj->invalidate) 689 if (eo_obj->invalidate || eo_obj->is_invalidating)
685 { 690 {
686 ERR("Call of efl_parent_set(%p, %p) when object is already invalidated.\n", obj, parent_id); 691 ERR("Call of efl_parent_set(%p, %p) when object is already invalidated.\n", obj, parent_id);
687 goto err_impossible; 692 goto err_impossible;
@@ -725,7 +730,6 @@ _efl_object_parent_set(Eo *obj, Efl_Object_Data *pd, Eo *parent_id)
725 } 730 }
726 else 731 else
727 { 732 {
728 eo_obj->invalidate = EINA_TRUE;
729 if (prev_parent) _efl_invalidate(eo_obj); 733 if (prev_parent) _efl_invalidate(eo_obj);
730 734
731 pd->parent = NULL; 735 pd->parent = NULL;
@@ -782,7 +786,7 @@ _efl_object_provider_find(const Eo *obj, Efl_Object_Data *pd, const Efl_Object *
782 if (invalidate) 786 if (invalidate)
783 { 787 {
784 ERR("Calling efl_provider_find(%p) after the object was invalidated.", obj); 788 ERR("Calling efl_provider_find(%p) after the object was invalidated.", obj);
785 return NULL; 789 return NULL;
786 } 790 }
787 if (pd->parent) return efl_provider_find(pd->parent, klass); 791 if (pd->parent) return efl_provider_find(pd->parent, klass);
788 return NULL; 792 return NULL;