summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <chuneon.park@samsung.com>2020-05-26 14:37:10 +0900
committerHermet Park <chuneon.park@samsung.com>2020-05-26 14:37:10 +0900
commit5855a093b81d6f17ca7a3c681422bc3a997bebca (patch)
treeb1657e03a074a5166a6f022d9072773047a67a66
parentb59834e782d581f155c832b9f9841b6cc4896346 (diff)
edje: fix animation memory leak.
if object is destructed on canvas animation, its internal resource is leaked. Here simple fix brings stopping animation before deleting obj. @fix
-rw-r--r--src/lib/edje/edje_load.c21
-rw-r--r--src/lib/evas/canvas/efl_canvas_object_animation.c7
2 files changed, 18 insertions, 10 deletions
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 783d8d0312..2fb3da0267 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -1881,14 +1881,6 @@ _edje_file_del(Edje *ed)
1881 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) 1881 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1882 _edje_entry_real_part_shutdown(ed, rp); 1882 _edje_entry_real_part_shutdown(ed, rp);
1883 1883
1884 if (rp->object)
1885 {
1886 _edje_callbacks_focus_del(rp->object, ed);
1887 _edje_callbacks_del(rp->object, ed);
1888 evas_object_del(rp->object);
1889 rp->object = NULL;
1890 }
1891
1892 if (rp->custom) 1884 if (rp->custom)
1893 { 1885 {
1894 // xxx: lua2 1886 // xxx: lua2
@@ -1956,7 +1948,10 @@ _edje_file_del(Edje *ed)
1956 (rp->typedata.vector)) 1948 (rp->typedata.vector))
1957 { 1949 {
1958 if (rp->typedata.vector->anim) 1950 if (rp->typedata.vector->anim)
1959 efl_del(rp->typedata.vector->anim); 1951 {
1952 efl_canvas_object_animation_stop(rp->object);
1953 efl_del(rp->typedata.vector->anim);
1954 }
1960 if (rp->typedata.vector->lottie_virtual_file) 1955 if (rp->typedata.vector->lottie_virtual_file)
1961 eina_file_close(rp->typedata.vector->lottie_virtual_file); 1956 eina_file_close(rp->typedata.vector->lottie_virtual_file);
1962 if (rp->typedata.vector->lottie_data) 1957 if (rp->typedata.vector->lottie_data)
@@ -1966,6 +1961,14 @@ _edje_file_del(Edje *ed)
1966 rp->typedata.vector = NULL; 1961 rp->typedata.vector = NULL;
1967 } 1962 }
1968 1963
1964 if (rp->object)
1965 {
1966 _edje_callbacks_focus_del(rp->object, ed);
1967 _edje_callbacks_del(rp->object, ed);
1968 evas_object_del(rp->object);
1969 rp->object = NULL;
1970 }
1971
1969 /* Cleanup optional part. */ 1972 /* Cleanup optional part. */
1970 free(rp->drag); 1973 free(rp->drag);
1971 rp->drag = NULL; 1974 rp->drag = NULL;
diff --git a/src/lib/evas/canvas/efl_canvas_object_animation.c b/src/lib/evas/canvas/efl_canvas_object_animation.c
index a017f73b96..d62d5890e8 100644
--- a/src/lib/evas/canvas/efl_canvas_object_animation.c
+++ b/src/lib/evas/canvas/efl_canvas_object_animation.c
@@ -167,6 +167,7 @@ _efl_canvas_object_animation_animation_start(Eo *obj, Efl_Canvas_Object_Animatio
167 efl_canvas_object_animation_stop(obj); 167 efl_canvas_object_animation_stop(obj);
168 EINA_SAFETY_ON_FALSE_RETURN(!pd->in); 168 EINA_SAFETY_ON_FALSE_RETURN(!pd->in);
169 in = pd->in = calloc(1, sizeof(Efl_Canvas_Object_Animation_Indirect_Data)); 169 in = pd->in = calloc(1, sizeof(Efl_Canvas_Object_Animation_Indirect_Data));
170 ERR("alloc pd->in = %p", pd->in);
170 171
171 EINA_SAFETY_ON_NULL_RETURN(animation); 172 EINA_SAFETY_ON_NULL_RETURN(animation);
172 EINA_SAFETY_ON_FALSE_RETURN(start_pos >= 0.0 && start_pos <= 1.0); 173 EINA_SAFETY_ON_FALSE_RETURN(start_pos >= 0.0 && start_pos <= 1.0);
@@ -195,6 +196,7 @@ _efl_canvas_object_animation_animation_start(Eo *obj, Efl_Canvas_Object_Animatio
195EOLIAN static void 196EOLIAN static void
196_efl_canvas_object_animation_animation_stop(Eo *obj, Efl_Canvas_Object_Animation_Data *pd) 197_efl_canvas_object_animation_animation_stop(Eo *obj, Efl_Canvas_Object_Animation_Data *pd)
197{ 198{
199 ERR("animation stop!");
198 if (!pd->in) return; 200 if (!pd->in) return;
199 201
200 if (!efl_animation_final_state_keep_get(pd->in->animation)) 202 if (!efl_animation_final_state_keep_get(pd->in->animation))
@@ -207,7 +209,10 @@ _efl_canvas_object_animation_animation_stop(Eo *obj, Efl_Canvas_Object_Animation
207 209
208 //this could be NULL if some weird callstack calls stop again while the above event is executed 210 //this could be NULL if some weird callstack calls stop again while the above event is executed
209 if (pd->in) 211 if (pd->in)
210 free(pd->in); 212 {
213 ERR("free pd->in = %p", pd->in);
214 free(pd->in);
215 }
211 pd->in = NULL; 216 pd->in = NULL;
212} 217}
213 218