diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2017-11-24 16:19:21 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2017-11-24 16:27:18 +0900 |
commit | dee149f3aae2cc44ee5614dbfa0e467ae3237301 (patch) | |
tree | 6ca505eadc439e77218b98510b76686e969dce6b | |
parent | 7e785d936db96b6c6ff572add0c5eacc1066dd7a (diff) | |
download | efl-dee149f3aae2cc44ee5614dbfa0e467ae3237301.tar.gz |
elm_part: Mark as auto-unref before finalize
This simplifies the IMPLEMENT macro, which can now be a proper function.
Also, do not set a parent for the part object, as it's not useful and
could mess up the refcount.
-rw-r--r-- | src/lib/elementary/elm_part_helper.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/lib/elementary/elm_part_helper.h b/src/lib/elementary/elm_part_helper.h index eef0d2fced..fd07059e60 100644 --- a/src/lib/elementary/elm_part_helper.h +++ b/src/lib/elementary/elm_part_helper.h @@ -1,6 +1,9 @@ #ifndef _ELM_PART_HELPER_H #define _ELM_PART_HELPER_H +#define EFL_OBJECT_BETA +#define EFL_OBJECT_PROTECTED + #include "Elementary.h" #include "elm_priv.h" #include "efl_ui_layout_part_legacy.eo.h" @@ -72,18 +75,19 @@ _elm_part_initialize(Eo *proxy, Eo *obj, const char *part) EINA_SAFETY_ON_FALSE_RETURN_VAL(pd && obj && part, NULL); efl_allow_parent_unref_set(proxy, 1); - // efl_auto_unref_set(proxy, 1); + efl_auto_unref_set(proxy, 1); pd->part = eina_tmpstr_add(part); pd->obj = obj; return proxy; } -#define ELM_PART_IMPLEMENT(PART_CLASS, _obj, _part) ({ \ - Eo *proxy = efl_add(PART_CLASS, (Eo *) _obj, \ - _elm_part_initialize(efl_added, (Eo *) _obj, _part)); \ - efl_auto_unref_set(proxy, 1); \ - proxy; }) +static inline Eo * +ELM_PART_IMPLEMENT(const Efl_Class *part_klass, const Eo *obj, const char *part) +{ + return efl_add(part_klass, NULL, + _elm_part_initialize(efl_added, (Eo *) obj, part)); +} #define ELM_PART_OVERRIDE_ONLY_ALIASES(type, TYPE, typedata, aliases) \ EOLIAN static Efl_Object * \ |