eo_debug: Improve one log

This changes the following message when the object is referencing
its own data. Also lowers from ERR to WRN and adds the class
name for the referenced data.

ERR<17450>:eo /home/jpeg/e/core/efl/src/lib/eo/eo_private.h:337
  _efl_unref_internal() in /home/jpeg/e/core/efl/src/lib/eo/eo.c:620:
  func '_efl_object_call_end' Data of object 0x400000021008db58 is
  still referenced by object 0x400000021008db58

Note that evas and elm have a few calls to efl_data_ref(obj, NULL)
which are imho quite ugly: not using the return value and not
specifying the data class. I'm keeping them as-is for now.
This commit is contained in:
Jean-Philippe Andre 2017-02-15 13:42:29 +09:00
parent c23ae314a4
commit a5535464bf
2 changed files with 13 additions and 1 deletions

View File

@ -1872,6 +1872,7 @@ _efl_data_xref_internal(const char *file, int line, _Eo_Object *obj, const _Efl_
(obj->datarefcount)++;
Eo_Xref_Node *xref = calloc(1, sizeof(*xref));
xref->ref_obj = _eo_obj_id_get(ref_obj);
xref->data_klass = klass ? klass->desc->name : NULL;
xref->file = file;
xref->line = line;

View File

@ -192,6 +192,7 @@ typedef struct
{
EINA_INLIST;
const Eo *ref_obj;
const char *data_klass;
const char *file;
int line;
} Eo_Xref_Node;
@ -334,7 +335,17 @@ _efl_unref_internal(_Eo_Object *obj, const char *func_name, const char *file, in
{
Eina_Inlist *nitr = obj->data_xrefs->next;
Eo_Xref_Node *xref = EINA_INLIST_CONTAINER_GET(obj->data_xrefs, Eo_Xref_Node);
ERR("in %s:%d: func '%s' Data of object 0x%lx is still referenced by object %p", file, line, func_name, (unsigned long) _eo_obj_id_get(obj), xref->ref_obj);
Eo *obj_id = _eo_obj_id_get(obj);
if (obj_id == xref->ref_obj)
{
WRN("in %s:%d: func '%s' Object %p still has a reference to its own data (subclass: %s). Origin: %s:%d",
file, line, func_name, obj_id, xref->data_klass, xref->file, xref->line);
}
else
{
ERR("in %s:%d: func '%s' Data of object %p (subclass: %s) is still referenced by object %p. Origin: %s:%d",
file, line, func_name, obj_id, xref->data_klass, xref->ref_obj, xref->file, xref->line);
}
eina_freeq_ptr_main_add(xref, free, sizeof(*xref));
obj->data_xrefs = nitr;