diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-07-21 13:42:37 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-07-21 13:49:37 +0900 |
commit | 6a559a6fff60e1bea2a9d956d12b10f53e761a2b (patch) | |
tree | 4a8521031a57d9419c4f304057412476301cb745 | |
parent | 83301ca6ba111bad14f3230c513b8fd19c59156e (diff) | |
download | efl-6a559a6fff60e1bea2a9d956d12b10f53e761a2b.tar.gz |
eo: Prevent eo_override to be called on an already overridden object
I don't see the point of it but can't be bothered to argue.
For Tom.
-rw-r--r-- | src/lib/eo/Eo.h | 4 | ||||
-rw-r--r-- | src/lib/eo/eo.c | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h index 58c26b4536..293234a15c 100644 --- a/src/lib/eo/Eo.h +++ b/src/lib/eo/Eo.h @@ -452,6 +452,10 @@ EAPI const Eo_Class *eo_class_new(const Eo_Class_Description *desc, const Eo_Cla * * If @p ops is #NULL, this will revert the @p obj to its original class * without any function overrides. + * + * It is not possible to override a function table of an object when it's + * already been overridden. Call eo_override(obj, NULL) first if you really + * need to do that. */ EAPI Eina_Bool eo_override(Eo *obj, const Eo_Ops *ops); diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index 52ba754ff6..a7df2b5a33 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -1360,6 +1360,12 @@ eo_override(Eo *eo_id, const Eo_Ops *ops) _vtable_init(obj->vtable, previous->size); _vtable_copy_all(obj->vtable, previous); } + else + { + ERR("Function table already overridden, not allowed to override again. " + "Call with NULL to reset the function table first."); + return EINA_FALSE; + } if (!_eo_class_funcs_set(obj->vtable, ops, obj->klass, klass, EINA_TRUE)) { |