diff options
author | Mike Blumenkrantz <zmike@samsung.com> | 2018-06-29 17:10:26 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2018-07-05 15:11:55 -0400 |
commit | cba95178d5bd76ce15beda5662749e54988fb900 (patch) | |
tree | 02a6d518982c7d349d8fad4caf7432962f377e31 /src/lib/eo/eo_base_class.c | |
parent | 7a8ff655c8c26afafadbf98d86d2bccb8c6ca3f2 (diff) |
eo/base_class: explicitly refuse to set an object as its own parent
somehow this has been possible until now. no.
@fix
Differential Revision: https://phab.enlightenment.org/D6489
Diffstat (limited to 'src/lib/eo/eo_base_class.c')
-rw-r--r-- | src/lib/eo/eo_base_class.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c index 16d59c0..5acc70b 100644 --- a/src/lib/eo/eo_base_class.c +++ b/src/lib/eo/eo_base_class.c | |||
@@ -715,7 +715,7 @@ _efl_object_parent_set(Eo *obj, Efl_Object_Data *pd, Eo *parent_id) | |||
715 | if (parent_id != NULL) | 715 | if (parent_id != NULL) |
716 | { | 716 | { |
717 | EO_OBJ_POINTER_GOTO(parent_id, parent_obj, err_impossible); | 717 | EO_OBJ_POINTER_GOTO(parent_id, parent_obj, err_impossible); |
718 | bad_parent = parent_obj->invalidate; | 718 | bad_parent = parent_obj->invalidate || (obj == parent_id); |
719 | EO_OBJ_DONE(parent_id); | 719 | EO_OBJ_DONE(parent_id); |
720 | } | 720 | } |
721 | 721 | ||
@@ -786,8 +786,12 @@ _efl_object_parent_set(Eo *obj, Efl_Object_Data *pd, Eo *parent_id) | |||
786 | err_parent_done: | 786 | err_parent_done: |
787 | EO_OBJ_DONE(obj); | 787 | EO_OBJ_DONE(obj); |
788 | err_parent: | 788 | err_parent: |
789 | ERR("New parent %p for object %p is not a valid Eo object.", | 789 | if (obj == parent_id) |
790 | parent_id, obj); | 790 | ERR("New parent %p for object %p will not be set: THIS IS THE SAME OBJECT.", |
791 | parent_id, obj); | ||
792 | else | ||
793 | ERR("New parent %p for object %p is not a valid Eo object.", | ||
794 | parent_id, obj); | ||
791 | return; | 795 | return; |
792 | 796 | ||
793 | err_impossible: | 797 | err_impossible: |