evas & elm: Fix invalid uses of efl_data_ref(obj, NULL)
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 15 Feb 2017 06:04:20 +0000 (15:04 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Wed, 15 Feb 2017 06:35:38 +0000 (15:35 +0900)
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
src/lib/elementary/elm_genlist.c
src/lib/elementary/elm_map.c
src/lib/elementary/elm_photocam.c
src/lib/elementary/elm_thumb.c
src/lib/evas/canvas/evas_layer.c
src/lib/evas/canvas/evas_object_smart.c
src/lib/evas/canvas/render2/evas_render2_th_main.c

index 489d19d..20a6d0b 100644 (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;
 
index fe79a12..4fb5fd0 100644 (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;
 
index bf00317..0a93398 100644 (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;
 
index 3ed1bb3..0dd18fc 100644 (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;
 
index 41f2cbf..205a033 100644 (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;
           }
 
index 7d29a58..86496c4 100644 (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;
index b90635c..7238069 100644 (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);
index 12d204c..1a7b3a4 100644 (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)                          \