summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-01 15:21:22 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-13 09:57:05 +0900
commite380dae4bc927f9710fa89c2831ebfa733b0e013 (patch)
tree496d9f6e8f8d1482dd18082589abca532684ac02
parent230b234891e22dd1cffd668642dc75ee023e58f5 (diff)
evas: Remove group_del override from smart clipped
-rw-r--r--src/lib/edje/edje_smart.c1
-rw-r--r--src/lib/evas/canvas/evas_object_box.c1
-rw-r--r--src/lib/evas/canvas/evas_object_smart.c44
-rw-r--r--src/lib/evas/canvas/evas_object_smart_clipped.c25
4 files changed, 41 insertions, 30 deletions
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index 85c4a55..136f2d1 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -148,7 +148,6 @@ _edje_object_efl_canvas_group_group_del(Eo *obj, Edje *ed)
148 _edje_block_violate(ed); 148 _edje_block_violate(ed);
149 ed->delete_me = 1; 149 ed->delete_me = 1;
150 _edje_edjes = eina_inlist_remove(_edje_edjes, EINA_INLIST_GET(ed)); 150 _edje_edjes = eina_inlist_remove(_edje_edjes, EINA_INLIST_GET(ed));
151 evas_object_smart_data_set(obj, NULL);
152 if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed); 151 if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed);
153#ifdef HAVE_EPHYSICS 152#ifdef HAVE_EPHYSICS
154 /* clear physics world / shutdown ephysics */ 153 /* clear physics world / shutdown ephysics */
diff --git a/src/lib/evas/canvas/evas_object_box.c b/src/lib/evas/canvas/evas_object_box.c
index b7e0218..8e053bc 100644
--- a/src/lib/evas/canvas/evas_object_box.c
+++ b/src/lib/evas/canvas/evas_object_box.c
@@ -408,7 +408,6 @@ _evas_box_efl_canvas_group_group_add(Eo *eo_obj, Evas_Object_Box_Data *priv)
408 cso = evas_object_smart_data_get(eo_obj); 408 cso = evas_object_smart_data_get(eo_obj);
409 priv->base = *cso; 409 priv->base = *cso;
410 evas_object_smart_data_set(eo_obj, priv); 410 evas_object_smart_data_set(eo_obj, priv);
411 free(cso);
412} 411}
413 412
414EOLIAN static void 413EOLIAN static void
diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c
index c82bd47..e94f788 100644
--- a/src/lib/evas/canvas/evas_object_smart.c
+++ b/src/lib/evas/canvas/evas_object_smart.c
@@ -49,6 +49,7 @@ struct _Evas_Smart_Data
49 Eina_Bool update_boundingbox_needed : 1; 49 Eina_Bool update_boundingbox_needed : 1;
50 Eina_Bool group_del_called : 1; 50 Eina_Bool group_del_called : 1;
51 Eina_Bool unclipped : 1; /* If true, NOT a smart_clipped object */ 51 Eina_Bool unclipped : 1; /* If true, NOT a smart_clipped object */
52 Eina_Bool data_nofree : 1; /* If true, do NOT free the data */
52}; 53};
53 54
54typedef struct 55typedef struct
@@ -130,7 +131,13 @@ EAPI void
130evas_object_smart_data_set(Evas_Object *eo_obj, void *data) 131evas_object_smart_data_set(Evas_Object *eo_obj, void *data)
131{ 132{
132 EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj); 133 EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj);
133 o->data = data; 134 if (o->data != data)
135 {
136 if (o->data && !o->data_nofree)
137 free(o->data);
138 o->data = data;
139 o->data_nofree = EINA_TRUE;
140 }
134} 141}
135 142
136EAPI void * 143EAPI void *
@@ -517,19 +524,23 @@ evas_object_smart_members_get_direct(const Evas_Object *eo_obj)
517 return o->contained; 524 return o->contained;
518} 525}
519 526
520void 527static void
521_efl_canvas_group_group_members_all_del(Evas_Object *eo_obj) 528_efl_canvas_group_group_members_all_del_internal(Evas_Smart_Data *o)
522{ 529{;
523 Evas_Smart_Data *o = efl_data_scope_get(eo_obj, MY_CLASS);
524 Evas_Object_Protected_Data *memobj; 530 Evas_Object_Protected_Data *memobj;
525 Eina_Inlist *itrn; 531 Eina_Inlist *itrn;
526 EINA_INLIST_FOREACH_SAFE(o->contained, itrn, memobj) 532 EINA_INLIST_FOREACH_SAFE(o->contained, itrn, memobj)
527 { 533 efl_del(memobj->object);
528 evas_object_del((Evas_Object *)((Evas_Object_Protected_Data *)memobj->object));
529 }
530 o->group_del_called = EINA_TRUE; 534 o->group_del_called = EINA_TRUE;
531} 535}
532 536
537void
538_efl_canvas_group_group_members_all_del(Evas_Object *eo_obj)
539{
540 Evas_Smart_Data *o = efl_data_scope_get(eo_obj, MY_CLASS);
541 _efl_canvas_group_group_members_all_del_internal(o);
542}
543
533static void 544static void
534_evas_smart_class_ifaces_private_data_alloc(Evas_Object *eo_obj, 545_evas_smart_class_ifaces_private_data_alloc(Evas_Object *eo_obj,
535 Evas_Smart *s) 546 Evas_Smart *s)
@@ -630,6 +641,8 @@ EOLIAN static void
630_efl_canvas_group_efl_object_destructor(Eo *eo_obj, Evas_Smart_Data *o) 641_efl_canvas_group_efl_object_destructor(Eo *eo_obj, Evas_Smart_Data *o)
631{ 642{
632 efl_destructor(efl_super(eo_obj, MY_CLASS)); 643 efl_destructor(efl_super(eo_obj, MY_CLASS));
644 if (o->data && !o->data_nofree)
645 free(o->data);
633 if (!o->group_del_called) 646 if (!o->group_del_called)
634 { 647 {
635 ERR("efl_canvas_group_del() was not called on this object: %p (%s)", 648 ERR("efl_canvas_group_del() was not called on this object: %p (%s)",
@@ -709,8 +722,21 @@ _efl_canvas_group_group_add(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED)
709} 722}
710 723
711EOLIAN static void 724EOLIAN static void
712_efl_canvas_group_group_del(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *o EINA_UNUSED) 725_efl_canvas_group_group_del(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *o)
713{ 726{
727 if (!o->unclipped)
728 {
729 Evas_Object_Smart_Clipped_Data *cso = o->data;
730 Eo *clipper;
731
732 if (cso && cso->clipper)
733 {
734 clipper = cso->clipper;
735 cso->clipper = NULL;
736 efl_del(clipper);
737 }
738 _efl_canvas_group_group_members_all_del_internal(o);
739 }
714 o->group_del_called = EINA_TRUE; 740 o->group_del_called = EINA_TRUE;
715} 741}
716 742
diff --git a/src/lib/evas/canvas/evas_object_smart_clipped.c b/src/lib/evas/canvas/evas_object_smart_clipped.c
index 50fb1b0..48e576e 100644
--- a/src/lib/evas/canvas/evas_object_smart_clipped.c
+++ b/src/lib/evas/canvas/evas_object_smart_clipped.c
@@ -22,7 +22,7 @@ evas_object_smart_clipped_clipper_get(const Evas_Object *eo_obj)
22} 22}
23 23
24static void 24static void
25evas_object_smart_clipped_smart_add(Evas_Object *eo_obj, Evas_Object_Smart_Clipped_Data *cso) 25evas_object_smart_clipped_init(Evas_Object *eo_obj, Evas_Object_Smart_Clipped_Data *cso)
26{ 26{
27 Evas_Object *clipper; 27 Evas_Object *clipper;
28 28
@@ -48,7 +48,7 @@ evas_object_smart_clipped_smart_add_legacy(Evas_Object *eo_obj)
48 Evas_Object_Smart_Clipped_Data *cso; 48 Evas_Object_Smart_Clipped_Data *cso;
49 49
50 cso = calloc(1, sizeof(*cso)); 50 cso = calloc(1, sizeof(*cso));
51 evas_object_smart_clipped_smart_add(eo_obj, cso); 51 evas_object_smart_clipped_init(eo_obj, cso);
52} 52}
53 53
54EOLIAN static void 54EOLIAN static void
@@ -57,11 +57,11 @@ _efl_canvas_group_clipped_efl_canvas_group_group_add(Eo *eo_obj, void *_pd EINA_
57 Evas_Object_Smart_Clipped_Data *cso; 57 Evas_Object_Smart_Clipped_Data *cso;
58 58
59 cso = evas_object_smart_data_get(eo_obj); 59 cso = evas_object_smart_data_get(eo_obj);
60 evas_object_smart_clipped_smart_add(eo_obj, cso); 60 evas_object_smart_clipped_init(eo_obj, cso);
61} 61}
62 62
63static void 63static void
64evas_object_smart_clipped_smart_del(Evas_Object *eo_obj) 64evas_object_smart_clipped_smart_del_legacy(Evas_Object *eo_obj)
65{ 65{
66 CSO_DATA_GET_OR_RETURN(eo_obj, cso); 66 CSO_DATA_GET_OR_RETURN(eo_obj, cso);
67 67
@@ -73,19 +73,6 @@ evas_object_smart_clipped_smart_del(Evas_Object *eo_obj)
73 } 73 }
74 74
75 _efl_canvas_group_group_members_all_del(eo_obj); 75 _efl_canvas_group_group_members_all_del(eo_obj);
76
77 /* If it's a legacy smart object, we should free the cso. */
78 if (!efl_isa(eo_obj, MY_CLASS))
79 free(cso);
80
81 evas_object_smart_data_set(eo_obj, NULL);
82}
83
84EOLIAN static void
85_efl_canvas_group_clipped_efl_canvas_group_group_del(Eo *eo_obj, void *_pd EINA_UNUSED)
86{
87 evas_object_smart_clipped_smart_del(eo_obj);
88 // group_del_called was already set to true, no need to call super here.
89} 76}
90 77
91static void 78static void
@@ -232,7 +219,7 @@ evas_object_smart_clipped_smart_set(Evas_Smart_Class *sc)
232 return; 219 return;
233 220
234 sc->add = evas_object_smart_clipped_smart_add_legacy; 221 sc->add = evas_object_smart_clipped_smart_add_legacy;
235 sc->del = evas_object_smart_clipped_smart_del; 222 sc->del = evas_object_smart_clipped_smart_del_legacy;
236 sc->move = evas_object_smart_clipped_smart_move; 223 sc->move = evas_object_smart_clipped_smart_move;
237 sc->show = evas_object_smart_clipped_smart_show; 224 sc->show = evas_object_smart_clipped_smart_show;
238 sc->hide = evas_object_smart_clipped_smart_hide; 225 sc->hide = evas_object_smart_clipped_smart_hide;
@@ -261,7 +248,7 @@ evas_object_smart_clipped_class_get(void)
261/* Internal EO APIs and hidden overrides */ 248/* Internal EO APIs and hidden overrides */
262 249
263#define EFL_CANVAS_GROUP_CLIPPED_EXTRA_OPS \ 250#define EFL_CANVAS_GROUP_CLIPPED_EXTRA_OPS \
264 EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_canvas_group_clipped) 251 EFL_CANVAS_GROUP_ADD_OPS(efl_canvas_group_clipped)
265 252
266#include "canvas/efl_canvas_group_clipped.eo.c" 253#include "canvas/efl_canvas_group_clipped.eo.c"
267 254