From 7ef714924ac6676ce73e340d07949e7c2a5b5a98 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Wed, 6 Sep 2017 12:13:58 +0900 Subject: [PATCH] evas: Fix crash with smart objects This is due to the previous patches. --- src/lib/edje/edje_smart.c | 2 +- src/lib/elementary/elm_interface_scrollable.c | 2 +- src/lib/elementary/elm_widget.c | 2 +- src/lib/emotion/emotion_smart.c | 2 +- src/lib/evas/Evas_Internal.h | 2 +- .../evas/canvas/efl_canvas_object_event_grabber.c | 2 +- src/lib/evas/canvas/evas_object_box.c | 2 +- src/lib/evas/canvas/evas_object_grid.c | 2 +- src/lib/evas/canvas/evas_object_smart.c | 32 +++++++++++----------- src/lib/evas/canvas/evas_object_smart_clipped.c | 12 ++++---- src/lib/evas/canvas/evas_object_table.c | 2 +- 11 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index 9ef755e..4d12f7e 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -30,7 +30,7 @@ _edje_object_efl_object_constructor(Eo *obj, Edje *ed) Evas *e; void *tmp; - efl_canvas_group_unclipped_set(obj, EINA_FALSE); + efl_canvas_group_clipped_set(obj, EINA_TRUE); obj = efl_constructor(efl_super(obj, MY_CLASS)); efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); ed->base = evas_object_smart_data_get(obj); diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c index d1a2ac7..ccdc7cf 100644 --- a/src/lib/elementary/elm_interface_scrollable.c +++ b/src/lib/elementary/elm_interface_scrollable.c @@ -198,7 +198,7 @@ _elm_pan_add(Evas *evas) EOLIAN static Eo * _elm_pan_efl_object_constructor(Eo *obj, Elm_Pan_Smart_Data *_pd EINA_UNUSED) { - efl_canvas_group_unclipped_set(obj, EINA_FALSE); + efl_canvas_group_clipped_set(obj, EINA_TRUE); obj = efl_constructor(efl_super(obj, MY_PAN_CLASS)); efl_canvas_object_type_set(obj, MY_PAN_CLASS_NAME_LEGACY); evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c index e2947eb..57f4c4a 100644 --- a/src/lib/elementary/elm_widget.c +++ b/src/lib/elementary/elm_widget.c @@ -6183,7 +6183,7 @@ _elm_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSE Eo *parent = NULL; sd->on_create = EINA_TRUE; - efl_canvas_group_unclipped_set(obj, EINA_TRUE); + efl_canvas_group_clipped_set(obj, EINA_FALSE); obj = efl_constructor(efl_super(obj, MY_CLASS)); efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c index 5b2dbf2..b2a7370 100644 --- a/src/lib/emotion/emotion_smart.c +++ b/src/lib/emotion/emotion_smart.c @@ -254,7 +254,7 @@ emotion_object_add(Evas *evas) EOLIAN static Eo * _efl_canvas_video_efl_object_constructor(Eo *obj, Efl_Canvas_Video_Data *pd EINA_UNUSED) { - efl_canvas_group_unclipped_set(obj, EINA_TRUE); + efl_canvas_group_clipped_set(obj, EINA_FALSE); obj = efl_constructor(efl_super(obj, MY_CLASS)); efl_canvas_object_type_set(obj, E_OBJ_NAME); diff --git a/src/lib/evas/Evas_Internal.h b/src/lib/evas/Evas_Internal.h index b4eb056..f0d71b5 100644 --- a/src/lib/evas/Evas_Internal.h +++ b/src/lib/evas/Evas_Internal.h @@ -53,7 +53,7 @@ EOAPI void efl_canvas_object_legacy_ctor(Eo *obj); EOAPI void efl_canvas_object_type_set(Eo *obj, const char *type); EOAPI void efl_canvas_group_add(Eo *obj); EOAPI void efl_canvas_group_del(Eo *obj); -EOAPI void efl_canvas_group_unclipped_set(Eo *obj, Eina_Bool unclipped); +EOAPI void efl_canvas_group_clipped_set(Eo *obj, Eina_Bool unclipped); EOAPI void *efl_input_legacy_info_get(const Eo *obj); EOAPI Eo *efl_input_instance_get(const Eo *obj, Efl_Object *owner, void **priv); diff --git a/src/lib/evas/canvas/efl_canvas_object_event_grabber.c b/src/lib/evas/canvas/efl_canvas_object_event_grabber.c index 18dc8c3..7623af9 100644 --- a/src/lib/evas/canvas/efl_canvas_object_event_grabber.c +++ b/src/lib/evas/canvas/efl_canvas_object_event_grabber.c @@ -320,7 +320,7 @@ _efl_canvas_object_event_grabber_efl_object_constructor(Eo *eo_obj, Efl_Object_E { Evas_Object_Protected_Data *obj; - efl_canvas_group_unclipped_set(eo_obj, EINA_TRUE); + efl_canvas_group_clipped_set(eo_obj, EINA_FALSE); eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); efl_canvas_object_type_set(eo_obj, MY_CLASS_NAME_LEGACY); obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); diff --git a/src/lib/evas/canvas/evas_object_box.c b/src/lib/evas/canvas/evas_object_box.c index 08e630b..5c48628 100644 --- a/src/lib/evas/canvas/evas_object_box.c +++ b/src/lib/evas/canvas/evas_object_box.c @@ -484,7 +484,7 @@ evas_object_box_add(Evas *evas) EOLIAN static Eo * _evas_box_efl_object_constructor(Eo *obj, Evas_Object_Box_Data *class_data EINA_UNUSED) { - efl_canvas_group_unclipped_set(obj, EINA_FALSE); + efl_canvas_group_clipped_set(obj, EINA_TRUE); obj = efl_constructor(efl_super(obj, MY_CLASS)); evas_object_smart_callbacks_descriptions_set(obj, _signals); efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); diff --git a/src/lib/evas/canvas/evas_object_grid.c b/src/lib/evas/canvas/evas_object_grid.c index 9b31c42..e8b9598 100644 --- a/src/lib/evas/canvas/evas_object_grid.c +++ b/src/lib/evas/canvas/evas_object_grid.c @@ -285,7 +285,7 @@ evas_object_grid_add(Evas *evas) EOLIAN static Eo * _evas_grid_efl_object_constructor(Eo *obj, Evas_Grid_Data *class_data EINA_UNUSED) { - efl_canvas_group_unclipped_set(obj, EINA_FALSE); + efl_canvas_group_clipped_set(obj, EINA_TRUE); obj = efl_constructor(efl_super(obj, MY_CLASS)); evas_object_smart_attach(obj, _evas_object_grid_smart_class_new()); diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c index b28b25f..7d98022 100644 --- a/src/lib/evas/canvas/evas_object_smart.c +++ b/src/lib/evas/canvas/evas_object_smart.c @@ -48,7 +48,7 @@ struct _Evas_Smart_Data Eina_Bool need_recalculate : 1; Eina_Bool update_boundingbox_needed : 1; Eina_Bool group_del_called : 1; - Eina_Bool unclipped : 1; /* If true, NOT a smart_clipped object */ + Eina_Bool clipped : 1; /* If true, smart clipped */ Eina_Bool data_nofree : 1; /* If true, do NOT free the data */ Eina_Bool constructed : 1; /* constructor finished */ }; @@ -129,7 +129,7 @@ static const Evas_Object_Func object_func = static inline Evas_Object * _smart_clipper_get(Evas_Smart_Data *o) { - Evas_Object_Smart_Clipped_Data *cso = (!o->unclipped) ? o->data : NULL; + Evas_Object_Smart_Clipped_Data *cso = o->clipped ? o->data : NULL; return cso ? cso->clipper : NULL; } @@ -294,7 +294,7 @@ _efl_canvas_group_group_member_add(Eo *smart_obj, Evas_Smart_Data *o, Evas_Objec if (!smart->is_frame_top && (smart->is_frame != obj->is_frame)) efl_canvas_object_is_frame_object_set(eo_obj, smart->is_frame); - if (!o->unclipped && o->constructed) + if (o->clipped && o->constructed) { Evas_Object *clipper = _smart_clipper_get(o); Eina_Bool had_clippees = efl_canvas_object_clipees_has(clipper); @@ -339,7 +339,7 @@ _efl_canvas_group_group_member_del(Eo *smart_obj, Evas_Smart_Data *_pd EINA_UNUS o = efl_data_scope_get(smart_obj, MY_CLASS); - if (!o->unclipped) + if (o->clipped) { Evas_Object *clipper = _smart_clipper_get(o); @@ -675,7 +675,7 @@ _efl_canvas_group_efl_object_constructor(Eo *eo_obj, Evas_Smart_Data *sd) obj->is_smart = EINA_TRUE; obj->func = &object_func; obj->private_data = efl_data_ref(eo_obj, MY_CLASS); - if (!sd->unclipped) + if (sd->clipped) _evas_object_smart_clipped_init(eo_obj); efl_canvas_object_type_set(eo_obj, MY_CLASS_NAME_LEGACY); @@ -798,7 +798,7 @@ _efl_canvas_group_group_add(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *o EINA_UNUS EOLIAN static void _efl_canvas_group_group_del(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *o) { - if (!o->unclipped) + if (o->clipped) { _efl_canvas_group_group_members_all_del_internal(o); } @@ -816,7 +816,7 @@ _efl_canvas_group_efl_canvas_object_no_render_set(Eo *eo_obj, Evas_Smart_Data *o efl_canvas_object_no_render_set(efl_super(eo_obj, MY_CLASS), enable); - clipper = (!o->unclipped) ? _smart_clipper_get(o) : NULL; + clipper = (o->clipped) ? _smart_clipper_get(o) : NULL; EINA_INLIST_FOREACH(o->contained, obj2) { if (obj2->object != clipper) @@ -832,7 +832,7 @@ _efl_canvas_group_efl_gfx_color_set(Eo *eo_obj, Evas_Smart_Data *o, int r, int g efl_gfx_color_set(efl_super(eo_obj, MY_CLASS), r, g, b, a); - if (!o->unclipped) + if (o->clipped) { Evas_Object *clipper = _smart_clipper_get(o); EINA_SAFETY_ON_NULL_RETURN(clipper); @@ -850,7 +850,7 @@ _efl_canvas_group_efl_gfx_visible_set(Eo *eo_obj, Evas_Smart_Data *o, Eina_Bool efl_gfx_visible_set(efl_super(eo_obj, MY_CLASS), vis); - if (!o->unclipped) + if (o->clipped) { Evas_Object *clipper = _smart_clipper_get(o); EINA_SAFETY_ON_NULL_RETURN(clipper); @@ -869,7 +869,7 @@ _efl_canvas_group_efl_gfx_position_set(Eo *eo_obj, Evas_Smart_Data *o, Evas_Coor if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) return; - if (!o->unclipped) + if (o->clipped) _evas_object_smart_clipped_smart_move_internal(eo_obj, x, y); efl_gfx_position_set(efl_super(eo_obj, MY_CLASS), x, y); } @@ -883,7 +883,7 @@ _efl_canvas_group_efl_canvas_object_clip_set(Eo *eo_obj, Evas_Smart_Data *o, Eva efl_canvas_object_clip_set(efl_super(eo_obj, MY_CLASS), clip); - if (!o->unclipped) + if (o->clipped) { Evas_Object *clipper = _smart_clipper_get(o); EINA_SAFETY_ON_NULL_RETURN(clipper); @@ -1820,12 +1820,12 @@ _efl_canvas_group_efl_canvas_object_paragraph_direction_get(Eo *eo_obj EINA_UNUS /* Internal EO */ static void -_efl_canvas_group_group_unclipped_set(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *sd, Eina_Bool unclipped) +_efl_canvas_group_group_clipped_set(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *sd, Eina_Bool clipped) { // We must call this function BEFORE the constructor (yes, it's hacky) EINA_SAFETY_ON_FALSE_RETURN(!sd->object); - sd->unclipped = !!unclipped; - if (!unclipped && !sd->data) + sd->clipped = !!clipped; + if (clipped && !sd->data) sd->data = calloc(1, sizeof(Evas_Object_Smart_Clipped_Data)); } @@ -1833,11 +1833,11 @@ _efl_canvas_group_group_unclipped_set(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *s EOAPI EFL_VOID_FUNC_BODY(efl_canvas_group_add) EOAPI EFL_VOID_FUNC_BODY(efl_canvas_group_del) -EOAPI EFL_VOID_FUNC_BODYV(efl_canvas_group_unclipped_set, EFL_FUNC_CALL(enable), Eina_Bool enable) +EOAPI EFL_VOID_FUNC_BODYV(efl_canvas_group_clipped_set, EFL_FUNC_CALL(enable), Eina_Bool enable) #define EFL_CANVAS_GROUP_EXTRA_OPS \ EFL_OBJECT_OP_FUNC(efl_canvas_group_add, _efl_canvas_group_group_add), \ EFL_OBJECT_OP_FUNC(efl_canvas_group_del, _efl_canvas_group_group_del), \ - EFL_OBJECT_OP_FUNC(efl_canvas_group_unclipped_set, _efl_canvas_group_group_unclipped_set) + EFL_OBJECT_OP_FUNC(efl_canvas_group_clipped_set, _efl_canvas_group_group_clipped_set) #include "canvas/efl_canvas_group.eo.c" diff --git a/src/lib/evas/canvas/evas_object_smart_clipped.c b/src/lib/evas/canvas/evas_object_smart_clipped.c index d3bfb98..f023045 100644 --- a/src/lib/evas/canvas/evas_object_smart_clipped.c +++ b/src/lib/evas/canvas/evas_object_smart_clipped.c @@ -1,5 +1,4 @@ -#define EFL_CANVAS_GROUP_PROTECTED -#define EFL_CANVAS_GROUP_BETA +/* Legacy only */ #include "evas_common_private.h" #include "evas_private.h" @@ -20,13 +19,13 @@ evas_object_smart_clipped_clipper_get(const Evas_Object *eo_obj) } static void -evas_object_smart_clipped_smart_add_legacy(Evas_Object *eo_obj) +evas_object_smart_clipped_smart_add(Evas_Object *eo_obj) { _evas_object_smart_clipped_init(eo_obj); } static void -evas_object_smart_clipped_smart_del_legacy(Evas_Object *eo_obj) +evas_object_smart_clipped_smart_del(Evas_Object *eo_obj) { CSO_DATA_GET_OR_RETURN(eo_obj, cso); @@ -105,15 +104,14 @@ evas_object_smart_clipped_smart_member_del(Evas_Object *eo_obj, Evas_Object *mem evas_object_hide(cso->clipper); } -/* Legacy only */ EAPI void evas_object_smart_clipped_smart_set(Evas_Smart_Class *sc) { if (!sc) return; - sc->add = evas_object_smart_clipped_smart_add_legacy; - sc->del = evas_object_smart_clipped_smart_del_legacy; + sc->add = evas_object_smart_clipped_smart_add; + sc->del = evas_object_smart_clipped_smart_del; sc->move = evas_object_smart_clipped_smart_move; sc->show = evas_object_smart_clipped_smart_show; sc->hide = evas_object_smart_clipped_smart_hide; diff --git a/src/lib/evas/canvas/evas_object_table.c b/src/lib/evas/canvas/evas_object_table.c index b6ad3dc..cfbb8bc 100644 --- a/src/lib/evas/canvas/evas_object_table.c +++ b/src/lib/evas/canvas/evas_object_table.c @@ -988,7 +988,7 @@ evas_object_table_add(Evas *evas) EOLIAN static Eo * _evas_table_efl_object_constructor(Eo *obj, Evas_Table_Data *class_data EINA_UNUSED) { - efl_canvas_group_unclipped_set(obj, EINA_FALSE); + efl_canvas_group_clipped_set(obj, EINA_TRUE); obj = efl_constructor(efl_super(obj, MY_CLASS)); efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); -- 2.7.4