From 50d508866e412a50da62af47ba6c71a6392a60bd Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Sat, 17 Sep 2016 05:49:32 +0900 Subject: [PATCH] eo invalid err - make the thread self more useful like main. --- src/lib/eo/eo.c | 4 ++++ src/lib/eo/eo_ptr_indirection.c | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index a9a994f9d9..7aa36f477a 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -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 diff --git a/src/lib/eo/eo_ptr_indirection.c b/src/lib/eo/eo_ptr_indirection.c index d9a927dded..f7f7efa201 100644 --- a/src/lib/eo/eo_ptr_indirection.c +++ b/src/lib/eo/eo_ptr_indirection.c @@ -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" : " ",