summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2020-03-06 13:25:04 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2020-03-06 14:33:07 +0900
commit2f9b4a7080b0b3ed1cf3f98e73f19e7fa135afae (patch)
tree70a17f1568f63bf2f6b85791e01232a277153d2a /src/bin
parentbd6608dd90736758bb8befc623af87eb97689a6c (diff)
elc_naviframe: fix to delete item once by elm_object_item_del in pop_cb
If elm_object_item_del is called in pop_cb and pop_cb returns EINA_FALSE, then the given item is destructed by _item_noref when efl_unref is called after pop_cb. After the above destruction, efl_del is called after the above efl_unref and it deletes the item again. Not to delete item after the item is destructed, efl_del after pop_cb is removed.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/elementary/test_naviframe.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/src/bin/elementary/test_naviframe.c b/src/bin/elementary/test_naviframe.c
index 81696148ba..36e4bdb332 100644
--- a/src/bin/elementary/test_naviframe.c
+++ b/src/bin/elementary/test_naviframe.c
@@ -65,6 +65,43 @@ _promote(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
65 elm_naviframe_item_promote(data); 65 elm_naviframe_item_promote(data);
66} 66}
67 67
68Eina_Bool
69_pop_cb(void *data EINA_UNUSED, Elm_Object_Item *it)
70{
71 elm_object_item_del(it);
72
73 /* If EINA_TRUE is returned, pop transition effect happens and then the item
74 * is automatically deleted.
75 * If EINA_FALSE is returned, pop transition effect does not happen and the
76 * item is not automatically deleted.
77 */
78 return EINA_FALSE;
79}
80
81void
82_page9(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
83{
84 Evas_Object *bt, *bt2, *nf = data;
85 Elm_Object_Item *it;
86
87 bt = elm_button_add(nf);
88 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
89 BUTTON_TEXT_SET(bt, "Page 8");
90
91 bt2 = elm_button_add(nf);
92 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
93 BUTTON_TEXT_SET(bt2, "Page 1");
94 evas_object_smart_callback_add(bt2, "clicked", _promote,
95 evas_object_data_get(nf, "page1"));
96
97 it = elm_naviframe_item_push(nf, "Page 9", bt, bt2, NULL, NULL);
98 elm_object_item_part_text_set(it, "subtitle", "Callback for naviframe item pop is set");
99
100 elm_naviframe_item_pop_cb_set(it, _pop_cb, NULL);
101
102 evas_object_smart_callback_add(bt, "clicked", _navi_pop, nf);
103}
104
68void 105void
69_page8(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 106_page8(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
70{ 107{
@@ -78,9 +115,9 @@ _page8(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
78 115
79 bt2 = elm_button_add(nf); 116 bt2 = elm_button_add(nf);
80 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL); 117 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
81 BUTTON_TEXT_SET(bt2, "Page 1"); 118 BUTTON_TEXT_SET(bt2, "Page 9");
82 evas_object_smart_callback_add(bt2, "clicked", _promote, 119 evas_object_smart_callback_add(bt2, "clicked", _page9, nf);
83 evas_object_data_get(nf, "page1")); 120
84 content = _content_new(nf, img6); 121 content = _content_new(nf, img6);
85 it = elm_naviframe_item_push(nf, "Page 8", bt, bt2, content, NULL); 122 it = elm_naviframe_item_push(nf, "Page 8", bt, bt2, content, NULL);
86 elm_object_item_part_text_set(it, "subtitle", "Overlap style!"); 123 elm_object_item_part_text_set(it, "subtitle", "Overlap style!");