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).
This commit is contained in:
Jean-Philippe Andre 2017-02-15 15:04:20 +09:00
parent b7213f2d64
commit a568d26f72
8 changed files with 10 additions and 14 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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) \