summaryrefslogtreecommitdiff
path: root/src/lib/eo/eo.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-16 15:29:56 +0200
committerCedric BAIL <cedric.bail@free.fr>2019-07-19 10:54:57 -0700
commita0952b0c01594e34f74a959d5dc4e8d54ab847c9 (patch)
treea26842ad1ac4e6d35c0ae6c3f953cfcfca935aa1 /src/lib/eo/eo.c
parente663b9da5521ad962d18d20e8def48c3e4bd786b (diff)
eo: add helper for checking the ownable state
if a object is ownable, then there is one free reference. If not, a error will be printed. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D9332
Diffstat (limited to 'src/lib/eo/eo.c')
-rw-r--r--src/lib/eo/eo.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index c1156ec..e2aed3c 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -3718,3 +3718,17 @@ efl_class_type_get(const Efl_Class *klass_id)
3718 3718
3719 return klass->desc->type; 3719 return klass->desc->type;
3720} 3720}
3721
3722
3723EAPI Eina_Bool
3724efl_ownable_get(const Eo *obj)
3725{
3726 int ref = efl_ref_count(obj);
3727
3728 if (efl_parent_get(obj))
3729 ref --;
3730
3731 if (ref <= 0)
3732 ERR("There is no free reference to pass this object. Please check that this object is really owned by you.");
3733 return (ref > 0);
3734}