forked from enlightenment/efl
edje: fix an overflow issue for state values
Summary: Whenever _edje_recalc_do() is called, a state value of Edje structure is increased. This increased value will be stored in Edje_Real_Part and Edje_Real_Part_State for calculation optimazation. But, once the state value is overflowed, it ruins calculation logic. @fix Test Plan: Run an Edje file which has infinite animation for over an hour. I'll attach an example to phab. Reviewers: raster, cedric, woohyun, Hermet Reviewed By: Hermet Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7264
This commit is contained in:
parent
c373f4936b
commit
b89b221b97
|
@ -938,6 +938,9 @@ _edje_recalc_do(Edje *ed)
|
||||||
{
|
{
|
||||||
unsigned short i;
|
unsigned short i;
|
||||||
Eina_Bool need_calc;
|
Eina_Bool need_calc;
|
||||||
|
#ifdef EDJE_CALC_CACHE
|
||||||
|
Eina_Bool need_reinit_state = EINA_FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
// XXX: dont need this with current smart calc infra. remove me later
|
// XXX: dont need this with current smart calc infra. remove me later
|
||||||
// ed->postponed = EINA_FALSE;
|
// ed->postponed = EINA_FALSE;
|
||||||
|
@ -946,6 +949,16 @@ _edje_recalc_do(Edje *ed)
|
||||||
if (!ed->dirty) return;
|
if (!ed->dirty) return;
|
||||||
ed->dirty = EINA_FALSE;
|
ed->dirty = EINA_FALSE;
|
||||||
ed->state++;
|
ed->state++;
|
||||||
|
|
||||||
|
/* Avoid overflow problem */
|
||||||
|
if (ed->state == USHRT_MAX)
|
||||||
|
{
|
||||||
|
ed->state = 0;
|
||||||
|
#ifdef EDJE_CALC_CACHE
|
||||||
|
need_reinit_state = EINA_TRUE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < ed->table_parts_size; i++)
|
for (i = 0; i < ed->table_parts_size; i++)
|
||||||
{
|
{
|
||||||
Edje_Real_Part *ep;
|
Edje_Real_Part *ep;
|
||||||
|
@ -953,6 +966,15 @@ _edje_recalc_do(Edje *ed)
|
||||||
ep = ed->table_parts[i];
|
ep = ed->table_parts[i];
|
||||||
ep->calculated = FLAG_NONE; // FIXME: this is dubious (see below)
|
ep->calculated = FLAG_NONE; // FIXME: this is dubious (see below)
|
||||||
ep->calculating = FLAG_NONE;
|
ep->calculating = FLAG_NONE;
|
||||||
|
#ifdef EDJE_CALC_CACHE
|
||||||
|
if (need_reinit_state)
|
||||||
|
{
|
||||||
|
ep->state = 0;
|
||||||
|
ep->param1.state = 0;
|
||||||
|
if (ep->param2)
|
||||||
|
ep->param2->state = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
for (i = 0; i < ed->table_parts_size; i++)
|
for (i = 0; i < ed->table_parts_size; i++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue