summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2014-01-22 22:13:51 +0900
committerChunEon Park <hermet@hermet.pe.kr>2014-01-22 22:13:51 +0900
commitbb39f8616f682af873ccf407086f8ce092369a11 (patch)
treebb95a5f52b9513811d561aa7784992edcbdceafd
parent502a62e19e9012e03475e537c4cb3f865522747f (diff)
[naviframe] Fix to enable item deletion in pop_cb
Summary: Fix to enable item deletion in the registered pop_cb function Reviewers: Hermet Reviewed By: Hermet CC: seoz Differential Revision: https://phab.enlightenment.org/D487
-rw-r--r--src/lib/elc_naviframe.c15
-rw-r--r--src/lib/elm_widget_naviframe.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/elc_naviframe.c b/src/lib/elc_naviframe.c
index a2a1f8564..c89fd0a4d 100644
--- a/src/lib/elc_naviframe.c
+++ b/src/lib/elc_naviframe.c
@@ -504,6 +504,9 @@ _item_del_pre_hook(Elm_Object_Item *it)
504 nit = (Elm_Naviframe_Item *)it; 504 nit = (Elm_Naviframe_Item *)it;
505 ELM_NAVIFRAME_DATA_GET(WIDGET(nit), sd); 505 ELM_NAVIFRAME_DATA_GET(WIDGET(nit), sd);
506 506
507 nit->delete_me = EINA_TRUE;
508 if (nit->ref > 0) return EINA_FALSE;
509
507 ecore_animator_del(nit->animator); 510 ecore_animator_del(nit->animator);
508 511
509 top = (it == elm_naviframe_top_item_get(WIDGET(nit))); 512 top = (it == elm_naviframe_top_item_get(WIDGET(nit)));
@@ -1696,14 +1699,26 @@ _item_pop(Eo *obj, void *_pd, va_list *list)
1696 if (it->popping) return; 1699 if (it->popping) return;
1697 it->popping = EINA_TRUE; 1700 it->popping = EINA_TRUE;
1698 1701
1702 evas_object_ref(obj);
1699 if (it->pop_cb) 1703 if (it->pop_cb)
1700 { 1704 {
1705 it->ref++;
1701 if (!it->pop_cb(it->pop_data, (Elm_Object_Item *)it)) 1706 if (!it->pop_cb(it->pop_data, (Elm_Object_Item *)it))
1702 { 1707 {
1708 it->ref--;
1709 if (it->delete_me)
1710 {
1711 _item_del_pre_hook(it);
1712 _elm_widget_item_free(it);
1713 }
1703 it->popping = EINA_FALSE; 1714 it->popping = EINA_FALSE;
1715 evas_object_unref(obj);
1716
1704 return; 1717 return;
1705 } 1718 }
1719 it->ref--;
1706 } 1720 }
1721 evas_object_unref(obj);
1707 1722
1708 if (sd->preserve) 1723 if (sd->preserve)
1709 content = it->content; 1724 content = it->content;
diff --git a/src/lib/elm_widget_naviframe.h b/src/lib/elm_widget_naviframe.h
index 83809f981..1b4d3fc28 100644
--- a/src/lib/elm_widget_naviframe.h
+++ b/src/lib/elm_widget_naviframe.h
@@ -57,6 +57,8 @@ struct _Elm_Naviframe_Item
57 Eina_Bool title_enabled : 1; 57 Eina_Bool title_enabled : 1;
58 Eina_Bool unfocusable : 1; 58 Eina_Bool unfocusable : 1;
59 Eina_Bool popping : 1; 59 Eina_Bool popping : 1;
60 Eina_Bool delete_me : 1;
61 int ref;
60}; 62};
61 63
62typedef struct _Elm_Naviframe_Content_Item_Pair Elm_Naviframe_Content_Item_Pair; 64typedef struct _Elm_Naviframe_Content_Item_Pair Elm_Naviframe_Content_Item_Pair;