jpeg pushed a commit to branch efl-1.20. http://git.enlightenment.org/core/efl.git/commit/?id=e3ecd398c0505fbb7f468b6c80bb62407d6dd94e
commit e3ecd398c0505fbb7f468b6c80bb62407d6dd94e Author: Jean-Philippe Andre <jp.an...@samsung.com> Date: Fri Aug 11 10:58:56 2017 +0900 eo: Check refs in efl_data_scope_safe_get This makes sure the object is actually still alive and kicking before returning any data. Otherwise the "safe" word is a bit of an abuse... Ref T5869 @fix --- src/lib/eo/eo.c | 1 + src/tests/eo/suite/eo_test_general.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index 5af21f5f74..26532b90c7 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -2015,6 +2015,7 @@ efl_data_scope_safe_get(const Eo *obj_id, const Efl_Class *klass_id) if (!obj_id) return NULL; EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, NULL); EO_CLASS_POINTER_GOTO(klass_id, klass, err_klass); + if (obj->user_refcount <= 0) goto err_klass; if (_eo_class_mro_has(obj->klass, klass)) ret = _efl_data_scope_safe_get(obj, klass); diff --git a/src/tests/eo/suite/eo_test_general.c b/src/tests/eo/suite/eo_test_general.c index 0d6f322f1f..26eac4435f 100644 --- a/src/tests/eo/suite/eo_test_general.c +++ b/src/tests/eo/suite/eo_test_general.c @@ -322,6 +322,7 @@ START_TEST(efl_data_safe_fetch) fail_if(efl_data_scope_safe_get(obj, SIMPLE2_CLASS) != NULL); fail_if(efl_data_scope_safe_get(NULL, EFL_OBJECT_CLASS) != NULL); efl_unref(obj); + fail_if(efl_data_scope_safe_get(obj, SIMPLE3_CLASS) != NULL); efl_object_shutdown(); } --