efl_ui_stack: Partially Revert "efl_ui_stack: remove unnecessary condition of EINA_INLIST_CONTAINER_GET return value"

This partially reverts commit 820dcb9cd9.

top_cd can be NULL when cd->stack is NULL.

Thanks to bu5hm4n for reporting.
Differential Revision: https://phab.enlightenment.org/D7116
This commit is contained in:
Yeongjong Lee 2018-09-27 07:33:37 +00:00 committed by Marcel Hollerbach
parent 2e8f00c1ff
commit 0e41b59f6d
1 changed files with 53 additions and 50 deletions

View File

@ -163,66 +163,69 @@ _efl_ui_stack_push(Eo *obj, Efl_Ui_Stack_Data *pd, Eo *content)
/* Apply transition to top content. /* Apply transition to top content.
* Hide top content with animation. */ * Hide top content with animation. */
Eo *top_content = top_cd->content; if (top_cd)
Efl_Canvas_Animation *orig_hide_anim =
efl_canvas_object_event_animation_get(top_content, EFL_GFX_ENTITY_EVENT_HIDE);
/* If content is being pushed now, then finish current animation and hide
* the content without animation. */
if (top_cd->on_pushing)
{ {
//Finish current animation. Eo *top_content = top_cd->content;
efl_canvas_object_event_animation_set(top_content,
EFL_GFX_ENTITY_EVENT_SHOW, NULL);
//Hide without animation. Efl_Canvas_Animation *orig_hide_anim =
if (orig_hide_anim) efl_canvas_object_event_animation_get(top_content, EFL_GFX_ENTITY_EVENT_HIDE);
efl_canvas_object_event_animation_set(top_content,
EFL_GFX_ENTITY_EVENT_HIDE, NULL);
efl_gfx_entity_visible_set(top_content, EINA_FALSE); /* If content is being pushed now, then finish current animation and hide
* the content without animation. */
if (top_cd->on_pushing)
{
//Finish current animation.
efl_canvas_object_event_animation_set(top_content,
EFL_GFX_ENTITY_EVENT_SHOW, NULL);
if (orig_hide_anim) //Hide without animation.
efl_canvas_object_event_animation_set(top_content, if (orig_hide_anim)
EFL_GFX_ENTITY_EVENT_HIDE, efl_canvas_object_event_animation_set(top_content,
orig_hide_anim); EFL_GFX_ENTITY_EVENT_HIDE, NULL);
//Deactivated Event efl_gfx_entity_visible_set(top_content, EINA_FALSE);
Efl_Ui_Stack_Event_Deactivated deactivated_info;
deactivated_info.content = top_content;
efl_event_callback_call(obj, EFL_UI_STACK_EVENT_DEACTIVATED,
&deactivated_info);
//Unloaded Event if (orig_hide_anim)
Efl_Ui_Stack_Event_Unloaded unloaded_info; efl_canvas_object_event_animation_set(top_content,
unloaded_info.content = top_content; EFL_GFX_ENTITY_EVENT_HIDE,
efl_event_callback_call(obj, EFL_UI_STACK_EVENT_UNLOADED, orig_hide_anim);
&unloaded_info);
}
else
{
top_cd->on_pushing = EINA_TRUE;
//Hide with animation. //Deactivated Event
if (!orig_hide_anim) Efl_Ui_Stack_Event_Deactivated deactivated_info;
efl_canvas_object_event_animation_set(top_content, deactivated_info.content = top_content;
EFL_GFX_ENTITY_EVENT_HIDE, efl_event_callback_call(obj, EFL_UI_STACK_EVENT_DEACTIVATED,
hide_anim); &deactivated_info);
Transit_Data *td = calloc(1, sizeof(Transit_Data)); //Unloaded Event
td->cd = top_cd; Efl_Ui_Stack_Event_Unloaded unloaded_info;
td->orig_anim = !!(orig_hide_anim); unloaded_info.content = top_content;
td->freeze_events = efl_canvas_object_freeze_events_get(top_content); efl_event_callback_call(obj, EFL_UI_STACK_EVENT_UNLOADED,
&unloaded_info);
}
else
{
top_cd->on_pushing = EINA_TRUE;
efl_event_callback_add(top_content, //Hide with animation.
EFL_CANVAS_OBJECT_EVENT_ANIM_STARTED, if (!orig_hide_anim)
_anim_started_cb, NULL); efl_canvas_object_event_animation_set(top_content,
efl_event_callback_add(top_content, EFL_GFX_ENTITY_EVENT_HIDE,
EFL_CANVAS_OBJECT_EVENT_ANIM_ENDED, hide_anim);
_anim_ended_cb, td);
efl_gfx_entity_visible_set(top_content, EINA_FALSE); Transit_Data *td = calloc(1, sizeof(Transit_Data));
td->cd = top_cd;
td->orig_anim = !!(orig_hide_anim);
td->freeze_events = efl_canvas_object_freeze_events_get(top_content);
efl_event_callback_add(top_content,
EFL_CANVAS_OBJECT_EVENT_ANIM_STARTED,
_anim_started_cb, NULL);
efl_event_callback_add(top_content,
EFL_CANVAS_OBJECT_EVENT_ANIM_ENDED,
_anim_ended_cb, td);
efl_gfx_entity_visible_set(top_content, EINA_FALSE);
}
} }
/* Prepare transition for new content. /* Prepare transition for new content.