path: root/src/lib/eo
diff options
authorCedric Bail <>2017-08-13 13:14:31 -0700
committerCedric Bail <>2017-08-13 13:18:04 -0700
commit87acc90fc770daa6c6fe43e237885d92b625637c (patch)
tree52413508c99115ebbf49370276a7147f18733418 /src/lib/eo
parent190af04983a8804ef2e59559b92261ca5ed138c7 (diff)
eo: only return NULL when the object is destructed.
There is a problem with the previous version. The object can still be alive due to the use of manual_free in evas. So you wouldn't be able for example to remove a callback from an object that hasn't been destroyed yet. If that callback is triggered by the destruction of the object, you would end up with an unexpected and impossible to prevent effect of access after free on a callback that you had removed. Not sure if that still solve the original problem that the code was trying to prevent in Ecore_Evas.
Diffstat (limited to 'src/lib/eo')
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index fb9f57f9ae..e47778e4b9 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -2053,7 +2053,10 @@ efl_data_scope_safe_get(const Eo *obj_id, const Efl_Class *klass_id)
2053 if (!obj_id) return NULL; 2053 if (!obj_id) return NULL;
2054 EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, NULL); 2054 EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, NULL);
2055 EO_CLASS_POINTER_GOTO(klass_id, klass, err_klass); 2055 EO_CLASS_POINTER_GOTO(klass_id, klass, err_klass);
2056 if (obj->user_refcount <= 0) goto err_klass; 2056 if (obj->destructed)
2057 {
2058 goto err_klass;
2059 }
2057 2060
2058 if (_eo_class_mro_has(obj->klass, klass)) 2061 if (_eo_class_mro_has(obj->klass, klass))
2059 ret = _efl_data_scope_safe_get(obj, klass); 2062 ret = _efl_data_scope_safe_get(obj, klass);