From a568d26f722140dcf2169e7cf474ca6366701ef5 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Wed, 15 Feb 2017 15:04:20 +0900 Subject: [PATCH] evas & elm: Fix invalid uses of efl_data_ref(obj, NULL) The data class should be specified for debug purposes. Also, this fixes invalid uses inside the smart object implementation where it assumed that the smart data was part of the eo data. It may not (legacy objects). --- src/lib/elementary/elm_gengrid.c | 2 +- src/lib/elementary/elm_genlist.c | 2 +- src/lib/elementary/elm_map.c | 2 +- src/lib/elementary/elm_photocam.c | 2 +- src/lib/elementary/elm_thumb.c | 4 ++-- src/lib/evas/canvas/evas_layer.c | 2 +- src/lib/evas/canvas/evas_object_smart.c | 8 ++------ src/lib/evas/canvas/render2/evas_render2_th_main.c | 2 +- 8 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c index 489d19d..20a6d0b 100644 --- a/src/lib/elementary/elm_gengrid.c +++ b/src/lib/elementary/elm_gengrid.c @@ -4588,7 +4588,7 @@ _elm_gengrid_efl_canvas_group_group_add(Eo *obj, Elm_Gengrid_Data *priv) priv->pan_obj = efl_add(MY_PAN_CLASS, evas_object_evas_get(obj)); pan_data = efl_data_scope_get(priv->pan_obj, MY_PAN_CLASS); - efl_data_ref(obj, NULL); + efl_data_ref(obj, MY_CLASS); pan_data->wobj = obj; pan_data->wsd = priv; diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c index fe79a12..4fb5fd0 100644 --- a/src/lib/elementary/elm_genlist.c +++ b/src/lib/elementary/elm_genlist.c @@ -5628,7 +5628,7 @@ _elm_genlist_efl_canvas_group_group_add(Eo *obj, Elm_Genlist_Data *priv) priv->pan_obj = efl_add(MY_PAN_CLASS, evas_object_evas_get(obj)); pan_data = efl_data_scope_get(priv->pan_obj, MY_PAN_CLASS); - efl_data_ref(obj, NULL); + efl_data_ref(obj, MY_CLASS); pan_data->wobj = obj; pan_data->wsd = priv; diff --git a/src/lib/elementary/elm_map.c b/src/lib/elementary/elm_map.c index bf00317..0a93398 100644 --- a/src/lib/elementary/elm_map.c +++ b/src/lib/elementary/elm_map.c @@ -4133,7 +4133,7 @@ _elm_map_efl_canvas_group_group_add(Eo *obj, Elm_Map_Data *priv) priv->pan_obj = efl_add(MY_PAN_CLASS, evas_object_evas_get(obj)); pan_data = efl_data_scope_get(priv->pan_obj, MY_PAN_CLASS); - efl_data_ref(obj, NULL); + efl_data_ref(obj, MY_CLASS); pan_data->wobj = obj; pan_data->wsd = priv; diff --git a/src/lib/elementary/elm_photocam.c b/src/lib/elementary/elm_photocam.c index 3ed1bb3..0dd18fc 100644 --- a/src/lib/elementary/elm_photocam.c +++ b/src/lib/elementary/elm_photocam.c @@ -1420,7 +1420,7 @@ _elm_photocam_efl_canvas_group_group_add(Eo *obj, Elm_Photocam_Data *priv) priv->pan_obj = efl_add(MY_PAN_CLASS, evas_object_evas_get(obj)); pan_data = efl_data_scope_get(priv->pan_obj, MY_PAN_CLASS); - efl_data_ref(obj, NULL); + efl_data_ref(obj, MY_CLASS); pan_data->wobj = obj; pan_data->wsd = priv; diff --git a/src/lib/elementary/elm_thumb.c b/src/lib/elementary/elm_thumb.c index 41f2cbf..205a033 100644 --- a/src/lib/elementary/elm_thumb.c +++ b/src/lib/elementary/elm_thumb.c @@ -229,7 +229,7 @@ _thumb_finish(Elm_Thumb_Data *sd, sd->thumb.retry = EINA_TRUE; retry = eina_list_append(retry, sd); - efl_data_ref(sd->obj, NULL); + efl_data_ref(sd->obj, MY_CLASS); return; } } @@ -259,7 +259,7 @@ _thumb_finish(Elm_Thumb_Data *sd, sd->thumb.retry = EINA_TRUE; retry = eina_list_append(retry, sd); - efl_data_ref(sd->obj, NULL); + efl_data_ref(sd->obj, MY_CLASS); return; } diff --git a/src/lib/evas/canvas/evas_layer.c b/src/lib/evas/canvas/evas_layer.c index 7d29a58..86496c4 100644 --- a/src/lib/evas/canvas/evas_layer.c +++ b/src/lib/evas/canvas/evas_layer.c @@ -22,7 +22,7 @@ evas_object_inject(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas *e lay->layer = obj->cur->layer; evas_layer_add(lay); } - efl_data_ref(eo_obj, NULL); + efl_data_ref(eo_obj, EFL_CANVAS_OBJECT_CLASS); lay->objects = (Evas_Object_Protected_Data *)eina_inlist_append(EINA_INLIST_GET(lay->objects), EINA_INLIST_GET(obj)); lay->usage++; obj->layer = lay; diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c index b90635c..7238069 100644 --- a/src/lib/evas/canvas/evas_object_smart.c +++ b/src/lib/evas/canvas/evas_object_smart.c @@ -77,7 +77,7 @@ _eo_evas_smart_cb(void *data, const Efl_Event *event) } /* private methods for smart objects */ -static void evas_object_smart_init(Evas_Object *eo_obj); +static inline void evas_object_smart_init(Evas_Object *eo_obj); static void evas_object_smart_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, void *type_private_data, @@ -130,9 +130,7 @@ EAPI void evas_object_smart_data_set(Evas_Object *eo_obj, void *data) { EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj); - if (o->data) efl_data_unref(eo_obj, o->data); o->data = data; - efl_data_ref(eo_obj, NULL); } EAPI void * @@ -268,7 +266,6 @@ _efl_canvas_group_group_member_add(Eo *smart_obj, Evas_Smart_Data *o, Evas_Objec obj->smart.parent_data = o; obj->smart.parent_object_data = smart; o->contained = eina_inlist_append(o->contained, EINA_INLIST_GET(obj)); - efl_data_ref(eo_obj, NULL); evas_object_smart_member_cache_invalidate(eo_obj, EINA_TRUE, EINA_TRUE, EINA_TRUE); obj->restack = 1; @@ -323,7 +320,6 @@ _efl_canvas_group_group_member_del(Eo *smart_obj, Evas_Smart_Data *_pd EINA_UNUS Evas_Smart_Data *o = efl_data_scope_get(smart_obj, MY_CLASS); o->contained = eina_inlist_remove(o->contained, EINA_INLIST_GET(obj)); - efl_data_unref(eo_obj, obj); o->member_count--; obj->smart.parent = NULL; evas_object_smart_member_cache_invalidate(eo_obj, EINA_TRUE, EINA_TRUE, EINA_TRUE); @@ -1493,7 +1489,7 @@ evas_object_smart_bounding_box_update(Evas_Object *eo_obj, Evas_Object_Protected } /* all nice and private */ -static void +static inline void evas_object_smart_init(Evas_Object *eo_obj) { Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); diff --git a/src/lib/evas/canvas/render2/evas_render2_th_main.c b/src/lib/evas/canvas/render2/evas_render2_th_main.c index 12d204c..1a7b3a4 100644 --- a/src/lib/evas/canvas/render2/evas_render2_th_main.c +++ b/src/lib/evas/canvas/render2/evas_render2_th_main.c @@ -4,7 +4,7 @@ do \ { \ eina_array_push(array, obj); \ - efl_data_ref(obj->object, NULL); \ + efl_data_ref(obj->object, EFL_CANVAS_OBJECT_CLASS); \ } while (0) #define OBJS_ARRAY_CLEAN(array) \ -- 2.7.4