From 5fd75e226bee6d6b526bdc5e37e6c28878a7d040 Mon Sep 17 00:00:00 2001 From: Yeongjong Lee Date: Fri, 26 Apr 2019 14:55:37 +0900 Subject: [PATCH] edje_calc: replace eina_stringshare_ref with eina_stringshare_add Summary: When there is circular dependency in edc, a bunch of CRI log is printed. This patch fixes it. ``` ERR<10159>:edje lib/edje/edje_calc.c:3919 _edje_part_recalc() Circular dependency in the group 'test' : longpartname -> longpartname -> longpartname2 ERR<10159>:edje lib/edje/edje_calc.c:3896 _edje_part_recalc() Circular dependency when calculating part "longpartname". Already calculating XY [03] axes. Need to calculate Y [02] axes CRI<10159>: lib/eina/eina_share_common.c:559 _eina_share_common_node_from_str() *** Eina Magic Check Failed at 0x7fb7c93ebf60 !!! Input handle is wrong type. Expected: 98761254 - Eina Stringshare Node Supplied: 2f736e6f - (unknown) CRI<10159>: lib/eina/eina_share_common.c:559 _eina_share_common_node_from_str() *** Eina Magic Check Failed at 0x7fb7c93ec5d1 !!! Input handle is wrong type. Expected: 98761254 - Eina Stringshare Node Supplied: 5f747261 - (unknown) ``` If string is already stored, `eina_stringshare_add` increase its reference count. Test Plan: test.c ``` //edje_cc test.edc && gcc -o test test.c `pkg-config --libs --cflags elementary` int main(int argc, char **argv) { elm_init(argc, argv); Evas_Object *win = elm_win_util_standard_add("test", "test"); Evas_Object *layout = elm_layout_add(win); elm_layout_file_set(layout, "./test.edj", "test"); elm_win_resize_object_add(win, layout); evas_object_show(layout); evas_object_resize(win, 200, 200); evas_object_show(win); elm_run(); elm_shutdown(); return 0; } ``` test.edc ``` collections { group { name: "test"; parts { rect { name: "longpartname"; desc { "default"; rel1.to: "longpartname2"; } } rect { name: "longpartname2"; type: RECT; desc { "default"; rel2.to: "longpartname"; } } } } } ``` Reviewers: SanghyeonLee, zmike Reviewed By: SanghyeonLee Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8717 Change-Id: I60a00da735f4e65b176badcb1219798b5aeff016 --- src/lib/edje/edje_calc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index 33b5af1..933ee88 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -3864,7 +3864,7 @@ _circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Ein rp = ed->table_parts[cep->param1.description->rel1.id_x]; if (_circular_dependency_find(ed, ep, rp, arr)) { - eina_array_push(arr, eina_stringshare_ref(rp->part->name)); + eina_array_push(arr, eina_stringshare_add(rp->part->name)); return EINA_TRUE; } } @@ -3873,7 +3873,7 @@ _circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Ein rp = ed->table_parts[cep->param1.description->rel2.id_x]; if (_circular_dependency_find(ed, ep, rp, arr)) { - eina_array_push(arr, eina_stringshare_ref(rp->part->name)); + eina_array_push(arr, eina_stringshare_add(rp->part->name)); return EINA_TRUE; } } @@ -3886,7 +3886,7 @@ _circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Ein rp = ed->table_parts[cep->param2->description->rel1.id_x]; if (_circular_dependency_find(ed, ep, rp, arr)) { - eina_array_push(arr, eina_stringshare_ref(rp->part->name)); + eina_array_push(arr, eina_stringshare_add(rp->part->name)); return EINA_TRUE; } } @@ -3895,7 +3895,7 @@ _circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Ein rp = ed->table_parts[cep->param2->description->rel2.id_x]; if (_circular_dependency_find(ed, ep, rp, arr)) { - eina_array_push(arr, eina_stringshare_ref(rp->part->name)); + eina_array_push(arr, eina_stringshare_add(rp->part->name)); return EINA_TRUE; } } @@ -3910,7 +3910,7 @@ _circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Ein rp = ed->table_parts[cep->param1.description->rel1.id_y]; if (_circular_dependency_find(ed, ep, rp, arr)) { - eina_array_push(arr, eina_stringshare_ref(rp->part->name)); + eina_array_push(arr, eina_stringshare_add(rp->part->name)); return EINA_TRUE; } } @@ -3919,7 +3919,7 @@ _circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Ein rp = ed->table_parts[cep->param1.description->rel2.id_y]; if (_circular_dependency_find(ed, ep, rp, arr)) { - eina_array_push(arr, eina_stringshare_ref(rp->part->name)); + eina_array_push(arr, eina_stringshare_add(rp->part->name)); return EINA_TRUE; } } @@ -3931,7 +3931,7 @@ _circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Ein rp = ed->table_parts[cep->param2->description->rel1.id_y]; if (_circular_dependency_find(ed, ep, rp, arr)) { - eina_array_push(arr, eina_stringshare_ref(rp->part->name)); + eina_array_push(arr, eina_stringshare_add(rp->part->name)); return EINA_TRUE; } } @@ -3940,7 +3940,7 @@ _circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Ein rp = ed->table_parts[cep->param2->description->rel2.id_y]; if (_circular_dependency_find(ed, ep, rp, arr)) { - eina_array_push(arr, eina_stringshare_ref(rp->part->name)); + eina_array_push(arr, eina_stringshare_add(rp->part->name)); return EINA_TRUE; } } -- 2.7.4