eo invalid err - make the thread self more useful like main.

This commit is contained in:
Carsten Haitzler 2016-09-17 05:49:32 +09:00
parent a453599d26
commit 50d508866e
2 changed files with 16 additions and 2 deletions

View File

@ -22,6 +22,7 @@
EAPI Eina_Lock _efl_class_creation_lock;
EAPI unsigned int _efl_object_init_generation = 1;
int _eo_log_dom = -1;
Eina_Thread _efl_object_main_thread;
static _Efl_Class **_eo_classes = NULL;
static Eo_Id _eo_classes_last_id = 0;
@ -1827,6 +1828,8 @@ efl_object_init(void)
eina_init();
_efl_object_main_thread = eina_thread_self();
_eo_sz = EO_ALIGN_SIZE(sizeof(_Eo_Object));
_eo_class_sz = EO_ALIGN_SIZE(sizeof(_Efl_Class));
@ -1891,6 +1894,7 @@ efl_object_init(void)
return EINA_FALSE;
}
eina_tls_set(_eo_table_data, data);
_efl_object_main_thread = eina_thread_self();
#ifdef EO_DEBUG
/* Call it just for coverage purposes. Ugly I know, but I like it better than

View File

@ -4,6 +4,8 @@
#include "eo_ptr_indirection.h"
extern Eina_Thread _efl_object_main_thread;
//////////////////////////////////////////////////////////////////////////
Eina_TLS _eo_table_data;
@ -23,12 +25,20 @@ _eo_obj_pointer_invalid(const Eo_Id obj_id,
Eo_Id_Data *data,
unsigned char domain)
{
Eina_Thread thread = eina_thread_self();
const char *tself = "main";
const char *type = "object";
char tbuf[128];
if (obj_id & ((Eo_Id)1 << (REF_TAG_SHIFT - 1))) type = "class";
if (thread != _efl_object_main_thread)
{
snprintf(tbuf, sizeof(tbuf), "%p", (void *)thread);
tself = tbuf;
}
ERR("EOID %p is not a valid %s. "
"EOID domain=%i, current_domain=%i, local_domain=%i. "
"EOID generation=%lx, id=%lx, ref=%i, super=%i. "
"Thread self=%lu. "
"Thread self=%s. "
"Available domains [%s %s %s %s]. "
"Maybe it has been deleted or does not belong to your thread?",
@ -41,7 +51,7 @@ _eo_obj_pointer_invalid(const Eo_Id obj_id,
(unsigned long)(obj_id >> SHIFT_ENTRY_ID) & (MAX_ENTRY_ID | MAX_TABLE_ID | MAX_MID_TABLE_ID),
(int)(obj_id >> REF_TAG_SHIFT) & 0x1,
(int)(obj_id >> SUPER_TAG_SHIFT) & 0x1,
(unsigned long)eina_thread_self(),
tself,
(data->tables[0]) ? "0" : " ",
(data->tables[1]) ? "1" : " ",
(data->tables[2]) ? "2" : " ",