summaryrefslogtreecommitdiff
path: root/src/lib/edje
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-06 14:39:22 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-08 09:50:48 +0900
commitff96e30c7239118b349883f8b1b882e9c64d10c5 (patch)
tree05b76d12dbde27cbd5ea606ee5f32f5925f09f8e /src/lib/edje
parent89f92afcccc46949ea72b0346472eda8a397ef52 (diff)
edje: Better debug logs for invalid calls to swallow
These error messages will be triggered when efl_part() is used, and the part is not a swallow part.
Diffstat (limited to 'src/lib/edje')
-rw-r--r--src/lib/edje/edje_part.c59
-rw-r--r--src/lib/edje/edje_part_helper.h1
2 files changed, 44 insertions, 16 deletions
diff --git a/src/lib/edje/edje_part.c b/src/lib/edje/edje_part.c
index 7442bab901..6fb1566366 100644
--- a/src/lib/edje/edje_part.c
+++ b/src/lib/edje/edje_part.c
@@ -5,24 +5,12 @@
5PROXY_IMPLEMENTATION(other, MY_CLASS, EINA_FALSE) 5PROXY_IMPLEMENTATION(other, MY_CLASS, EINA_FALSE)
6#undef PROXY_IMPLEMENTATION 6#undef PROXY_IMPLEMENTATION
7 7
8void 8const char *
9_part_reuse_error(Efl_Canvas_Layout_Internal_Data *pd) 9_part_type_to_string(unsigned char type)
10{ 10{
11 const char *typestr = "UNKNOWN"; 11 const char *typestr = "UNKNOWN";
12 Edje *ed;
13
14 // TODO: Enable full debug only for eo_debug?
15 // Don't trust pd->ed as it may be invalid now.
16 ed = efl_data_scope_safe_get(pd->obj, EDJE_OBJECT_CLASS);
17 if (!ed)
18 {
19 ERR("A previous misuse of efl_part has been detected. Handles returned "
20 "by efl_part() are valid for a single function call. Did you call "
21 "a non implemented function? obj: %p has been deleted!", pd->obj);
22 return;
23 }
24 12
25 switch (pd->rp->part->type) 13 switch (type)
26 { 14 {
27 case EDJE_PART_TYPE_RECTANGLE: typestr = "RECTANGLE"; break; 15 case EDJE_PART_TYPE_RECTANGLE: typestr = "RECTANGLE"; break;
28 case EDJE_PART_TYPE_TEXT: typestr = "TEXT"; break; 16 case EDJE_PART_TYPE_TEXT: typestr = "TEXT"; break;
@@ -44,10 +32,29 @@ _part_reuse_error(Efl_Canvas_Layout_Internal_Data *pd)
44 default: break; 32 default: break;
45 } 33 }
46 34
35 return typestr;
36}
37
38void
39_part_reuse_error(Efl_Canvas_Layout_Internal_Data *pd)
40{
41 Edje *ed;
42
43 // TODO: Enable full debug only for eo_debug?
44 // Don't trust pd->ed as it may be invalid now.
45 ed = efl_data_scope_safe_get(pd->obj, EDJE_OBJECT_CLASS);
46 if (!ed)
47 {
48 ERR("A previous misuse of efl_part has been detected. Handles returned "
49 "by efl_part() are valid for a single function call. Did you call "
50 "a non implemented function? obj: %p has been deleted!", pd->obj);
51 return;
52 }
53
47 ERR("A previous misuse of efl_part has been detected. Handles returned " 54 ERR("A previous misuse of efl_part has been detected. Handles returned "
48 "by efl_part() are valid for a single function call. Did you call " 55 "by efl_part() are valid for a single function call. Did you call "
49 "a non implemented function? obj: %p group: '%s' part: '%s' type: %s%s", 56 "a non implemented function? obj: %p group: '%s' part: '%s' type: %s%s",
50 pd->obj, ed->group, pd->part, typestr, 57 pd->obj, ed->group, pd->part, _part_type_to_string(pd->rp->part->type),
51 ed->delete_me ? ". This object is already deleted." : ""); 58 ed->delete_me ? ". This object is already deleted." : "");
52} 59}
53 60
@@ -206,4 +213,24 @@ _efl_canvas_layout_internal_efl_ui_drag_drag_page_move(Eo *obj, Efl_Canvas_Layou
206 RETURN_VAL(_edje_object_part_drag_page(pd->ed, pd->part, dx, dy)); 213 RETURN_VAL(_edje_object_part_drag_page(pd->ed, pd->part, dx, dy));
207} 214}
208 215
216static Eo *
217_edje_invalid_part_efl_content_get(Eo *obj, Efl_Canvas_Layout_Internal_Data *pd)
218{
219 ERR("Part '%s' (type: %s) of group '%s' is not a SWALLOW part!", pd->part, _part_type_to_string(pd->rp->type), pd->ed->group);
220 RETURN_VAL(NULL);
221}
222
223static Eina_Bool
224_edje_invalid_part_efl_content_set(Eo *obj, Efl_Canvas_Layout_Internal_Data *pd, Eo *subobj EINA_UNUSED)
225{
226 ERR("Part '%s' (type: %s) of group '%s' is not a SWALLOW part!", pd->part, _part_type_to_string(pd->rp->type), pd->ed->group);
227 RETURN_VAL(EINA_FALSE);
228}
229
230/* Internal EO APIs and hidden overrides */
231
232#define EFL_CANVAS_LAYOUT_INTERNAL_EXTRA_OPS \
233 EFL_OBJECT_OP_FUNC(efl_content_get, _edje_invalid_part_efl_content_get), \
234 EFL_OBJECT_OP_FUNC(efl_content_set, _edje_invalid_part_efl_content_set), \
235
209#include "efl_canvas_layout_internal.eo.c" 236#include "efl_canvas_layout_internal.eo.c"
diff --git a/src/lib/edje/edje_part_helper.h b/src/lib/edje/edje_part_helper.h
index e872ca30af..f72dadcc65 100644
--- a/src/lib/edje/edje_part_helper.h
+++ b/src/lib/edje/edje_part_helper.h
@@ -21,6 +21,7 @@ struct _Part_Item_Iterator
21}; 21};
22 22
23void _part_reuse_error(Efl_Canvas_Layout_Internal_Data *pd); 23void _part_reuse_error(Efl_Canvas_Layout_Internal_Data *pd);
24const char * _part_type_to_string(unsigned char type);
24 25
25#define PROXY_CALL_BEGIN(pd) do { pd->in_call = 1; } while (0) 26#define PROXY_CALL_BEGIN(pd) do { pd->in_call = 1; } while (0)
26#define PROXY_CALL_END(pd) do { pd->in_call = 0; } while (0) 27#define PROXY_CALL_END(pd) do { pd->in_call = 0; } while (0)