forked from enlightenment/efl
ecore: early destruction of animator allow for tick end to always be triggered.
T4043
This commit is contained in:
parent
46904e19a7
commit
fd5d31696d
|
@ -277,8 +277,8 @@ _do_tick(void)
|
||||||
if (animators) eina_evlog("!FRAME", NULL, ecore_loop_time_get(), NULL);
|
if (animators) eina_evlog("!FRAME", NULL, ecore_loop_time_get(), NULL);
|
||||||
EINA_INLIST_FOREACH(animators, animator)
|
EINA_INLIST_FOREACH(animators, animator)
|
||||||
{
|
{
|
||||||
if ((!animator->delete_me) &&
|
if ((!animator->delete_me) &&
|
||||||
(!animator->suspended) &&
|
(!animator->suspended) &&
|
||||||
(!animator->just_added))
|
(!animator->just_added))
|
||||||
{
|
{
|
||||||
animator_ran = EINA_TRUE;
|
animator_ran = EINA_TRUE;
|
||||||
|
@ -292,32 +292,8 @@ _do_tick(void)
|
||||||
}
|
}
|
||||||
else animator->just_added = EINA_FALSE;
|
else animator->just_added = EINA_FALSE;
|
||||||
}
|
}
|
||||||
if (animators_delete_me)
|
if (!_ecore_animator_flush())
|
||||||
{
|
return ECORE_CALLBACK_CANCEL;
|
||||||
Ecore_Animator *l;
|
|
||||||
for (l = animators; l; )
|
|
||||||
{
|
|
||||||
animator = l;
|
|
||||||
l = (Ecore_Animator *)EINA_INLIST_GET(l)->next;
|
|
||||||
if (animator->delete_me)
|
|
||||||
{
|
|
||||||
if (animator->suspended) animators_suspended--;
|
|
||||||
animators = (Ecore_Animator *)
|
|
||||||
eina_inlist_remove(EINA_INLIST_GET(animators),
|
|
||||||
EINA_INLIST_GET(animator));
|
|
||||||
|
|
||||||
free(animator);
|
|
||||||
|
|
||||||
animators_delete_me--;
|
|
||||||
if (animators_delete_me == 0) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!_have_animators())
|
|
||||||
{
|
|
||||||
_end_tick();
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,6 +611,7 @@ ecore_animator_del(Ecore_Animator *animator)
|
||||||
data = animator->data;
|
data = animator->data;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
animator->delete_me = EINA_TRUE;
|
animator->delete_me = EINA_TRUE;
|
||||||
animators_delete_me++;
|
animators_delete_me++;
|
||||||
if (animator->run_func)
|
if (animator->run_func)
|
||||||
|
@ -643,6 +620,7 @@ ecore_animator_del(Ecore_Animator *animator)
|
||||||
data = animator->data;
|
data = animator->data;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
if (!in_main_loop) _ecore_animator_flush();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -786,3 +764,37 @@ _ecore_animator_run(void *data)
|
||||||
if (t >= (animator->start + animator->run)) run_ret = EINA_FALSE;
|
if (t >= (animator->start + animator->run)) run_ret = EINA_FALSE;
|
||||||
return run_ret;
|
return run_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
_ecore_animator_flush(void)
|
||||||
|
{
|
||||||
|
Ecore_Animator *animator;
|
||||||
|
|
||||||
|
if (animators_delete_me)
|
||||||
|
{
|
||||||
|
Ecore_Animator *l;
|
||||||
|
for (l = animators; l; )
|
||||||
|
{
|
||||||
|
animator = l;
|
||||||
|
l = (Ecore_Animator *)EINA_INLIST_GET(l)->next;
|
||||||
|
if (animator->delete_me)
|
||||||
|
{
|
||||||
|
if (animator->suspended) animators_suspended--;
|
||||||
|
animators = (Ecore_Animator *)
|
||||||
|
eina_inlist_remove(EINA_INLIST_GET(animators),
|
||||||
|
EINA_INLIST_GET(animator));
|
||||||
|
|
||||||
|
free(animator);
|
||||||
|
|
||||||
|
animators_delete_me--;
|
||||||
|
if (animators_delete_me == 0) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!_have_animators())
|
||||||
|
{
|
||||||
|
_end_tick();
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -273,8 +273,9 @@ static int _ecore_main_win32_select(int nfds,
|
||||||
static void _ecore_main_win32_handlers_cleanup(void);
|
static void _ecore_main_win32_handlers_cleanup(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int in_main_loop = 0;
|
||||||
|
|
||||||
static unsigned char _ecore_exit_code = 0;
|
static unsigned char _ecore_exit_code = 0;
|
||||||
static int in_main_loop = 0;
|
|
||||||
static int do_quit = 0;
|
static int do_quit = 0;
|
||||||
static Ecore_Fd_Handler *fd_handlers = NULL;
|
static Ecore_Fd_Handler *fd_handlers = NULL;
|
||||||
static Ecore_Fd_Handler *fd_handler_current = NULL;
|
static Ecore_Fd_Handler *fd_handler_current = NULL;
|
||||||
|
@ -2351,6 +2352,8 @@ process_all: /*-*********************************************************/
|
||||||
}
|
}
|
||||||
|
|
||||||
done: /*-*****************************************************************/
|
done: /*-*****************************************************************/
|
||||||
|
/* Agressively flush animator */
|
||||||
|
_ecore_animator_flush();
|
||||||
in_main_loop--;
|
in_main_loop--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -248,6 +248,7 @@ void _ecore_exe_event_del_free(void *data,
|
||||||
void _ecore_animator_shutdown(void);
|
void _ecore_animator_shutdown(void);
|
||||||
void _ecore_animator_run_reset(void);
|
void _ecore_animator_run_reset(void);
|
||||||
Eina_Bool _ecore_animator_run_get(void);
|
Eina_Bool _ecore_animator_run_get(void);
|
||||||
|
Eina_Bool _ecore_animator_flush(void);
|
||||||
|
|
||||||
void _ecore_poller_shutdown(void);
|
void _ecore_poller_shutdown(void);
|
||||||
|
|
||||||
|
@ -336,6 +337,7 @@ extern int _ecore_fps_debug;
|
||||||
extern double _ecore_time_loop_time;
|
extern double _ecore_time_loop_time;
|
||||||
extern Eina_Bool _ecore_glib_always_integrate;
|
extern Eina_Bool _ecore_glib_always_integrate;
|
||||||
extern Ecore_Select_Function main_loop_select;
|
extern Ecore_Select_Function main_loop_select;
|
||||||
|
extern int in_main_loop;
|
||||||
|
|
||||||
Eina_Bool ecore_mempool_init(void);
|
Eina_Bool ecore_mempool_init(void);
|
||||||
void ecore_mempool_shutdown(void);
|
void ecore_mempool_shutdown(void);
|
||||||
|
|
Loading…
Reference in New Issue