summaryrefslogtreecommitdiff
path: root/src/lib/edje/edje_calc.c
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2018-11-14 16:43:13 +0900
committerHermet Park <hermetpark@gmail.com>2018-11-14 16:43:13 +0900
commitb89b221b97897a29d009fc5910274c545d33e06f (patch)
tree9d7402933ccf6759a391462238df8757ed545d39 /src/lib/edje/edje_calc.c
parentc373f4936beed4bbaf9ef23f465d7a223e754fff (diff)
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
Diffstat (limited to 'src/lib/edje/edje_calc.c')
-rw-r--r--src/lib/edje/edje_calc.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 1055791495..5877ebb6ed 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -938,6 +938,9 @@ _edje_recalc_do(Edje *ed)
938{ 938{
939 unsigned short i; 939 unsigned short i;
940 Eina_Bool need_calc; 940 Eina_Bool need_calc;
941#ifdef EDJE_CALC_CACHE
942 Eina_Bool need_reinit_state = EINA_FALSE;
943#endif
941 944
942// XXX: dont need this with current smart calc infra. remove me later 945// XXX: dont need this with current smart calc infra. remove me later
943// ed->postponed = EINA_FALSE; 946// ed->postponed = EINA_FALSE;
@@ -946,6 +949,16 @@ _edje_recalc_do(Edje *ed)
946 if (!ed->dirty) return; 949 if (!ed->dirty) return;
947 ed->dirty = EINA_FALSE; 950 ed->dirty = EINA_FALSE;
948 ed->state++; 951 ed->state++;
952
953 /* Avoid overflow problem */
954 if (ed->state == USHRT_MAX)
955 {
956 ed->state = 0;
957#ifdef EDJE_CALC_CACHE
958 need_reinit_state = EINA_TRUE;
959#endif
960 }
961
949 for (i = 0; i < ed->table_parts_size; i++) 962 for (i = 0; i < ed->table_parts_size; i++)
950 { 963 {
951 Edje_Real_Part *ep; 964 Edje_Real_Part *ep;
@@ -953,6 +966,15 @@ _edje_recalc_do(Edje *ed)
953 ep = ed->table_parts[i]; 966 ep = ed->table_parts[i];
954 ep->calculated = FLAG_NONE; // FIXME: this is dubious (see below) 967 ep->calculated = FLAG_NONE; // FIXME: this is dubious (see below)
955 ep->calculating = FLAG_NONE; 968 ep->calculating = FLAG_NONE;
969#ifdef EDJE_CALC_CACHE
970 if (need_reinit_state)
971 {
972 ep->state = 0;
973 ep->param1.state = 0;
974 if (ep->param2)
975 ep->param2->state = 0;
976 }
977#endif
956 } 978 }
957 for (i = 0; i < ed->table_parts_size; i++) 979 for (i = 0; i < ed->table_parts_size; i++)
958 { 980 {