diff options
author | Daniel Zaoui <daniel.zaoui@samsung.com> | 2016-11-09 07:39:10 +0200 |
---|---|---|
committer | Daniel Zaoui <daniel.zaoui@samsung.com> | 2016-11-09 07:42:57 +0200 |
commit | 0c78e1eb4d61ae42fcd24a59acef641bb3188636 (patch) | |
tree | 9b4870c3d44e866893e5b9bd03ffcc323888ecdd | |
parent | 7957041d845a0130f57be7abad4acd1f61141764 (diff) | |
download | efl-0c78e1eb4d61ae42fcd24a59acef641bb3188636.tar.gz |
Toolbar: fix icon switch during state change
When many states are set on an item, the icon is deleted when the state
is changed. This shouldn't be as it leads to an unstable state whose
icon is still considered as existing and errors displayed on the screen.
We need to check that the icon is not used inside any state to permit its
deletion. Otherwise we should just hide it.
@fix
-rw-r--r-- | src/lib/elementary/elm_toolbar.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/elementary/elm_toolbar.c b/src/lib/elementary/elm_toolbar.c index 67f9518091..e9bbc9f02b 100644 --- a/src/lib/elementary/elm_toolbar.c +++ b/src/lib/elementary/elm_toolbar.c @@ -2626,7 +2626,16 @@ _elm_toolbar_item_icon_obj_set(Evas_Object *obj, } if (item->icon) { - evas_object_del(item->icon); + Elm_Toolbar_Item_State *it_state; + Eina_List *l; + Eina_Bool found = EINA_FALSE; + EINA_LIST_FOREACH(item->states, l, it_state) + { + found |= (it_state->icon == item->icon); + } + if (!found) evas_object_del(item->icon); + else evas_object_hide(item->icon); + elm_layout_content_unset(VIEW(item), "elm.swallow.icon"); } item->icon = icon_obj; |