eo: start printing warning when instanciating object with efl_add and no parent.

This commit is contained in:
Cedric BAIL 2018-03-14 12:41:22 -07:00 committed by Cedric Bail
parent 3f5ac71ad6
commit e1a53fe125
1 changed files with 6 additions and 1 deletions

View File

@ -858,7 +858,7 @@ err_klass:
}
EAPI Eo *
_efl_add_internal_start(const char *file, int line, const Efl_Class *klass_id, Eo *parent_id, Eina_Bool ref EINA_UNUSED, Eina_Bool is_fallback)
_efl_add_internal_start(const char *file, int line, const Efl_Class *klass_id, Eo *parent_id, Eina_Bool ref, Eina_Bool is_fallback)
{
const char *func_name = __FUNCTION__;
_Eo_Object *obj;
@ -868,6 +868,11 @@ _efl_add_internal_start(const char *file, int line, const Efl_Class *klass_id, E
EO_CLASS_POINTER_GOTO_PROXY(klass_id, klass, err_klass);
// Check that in the case of efl_add we do pass a parent.
if (!ref && !parent_id)
ERR("Creation of '%s' object at line %i in '%s' is done without parent. This should use efl_add_ref.",
klass->desc->name, line, file);
if (parent_id)
{
EO_OBJ_POINTER_GOTO_PROXY(parent_id, parent, err_parent);