elementary: Efl.Ui.Layout should use the new API efl_content to control object lifecy...
authorCedric BAIL <cedric.bail@free.fr>
Sat, 2 Mar 2019 00:22:08 +0000 (16:22 -0800)
committerWonki Kim <wonki_.kim@samsung.com>
Fri, 8 Mar 2019 11:49:37 +0000 (20:49 +0900)
efl_content leave the caller in charge of the lifecycle of the object. This means we can
rely on the factory to actually do something with the object before it is destroyed by anyone.

Reviewed-by: Vitor Sousa da Silva <vitorsousa@expertisesolutions.com.br>
Differential Revision: https://phab.enlightenment.org/D8091

src/lib/elementary/efl_ui_layout.c

index 998dfc79d1b3202db08582ae19c502dfc7e13645..58a4ee342890c06a0550123f3f6f207c594260c1 100644 (file)
@@ -2205,7 +2205,7 @@ _efl_ui_layout_view_model_signal_update(Efl_Ui_Layout_Data *pd, const char *sign
         Eina_Error error;
 
         eina_value_get(v, &error);
-        ERR("Failed to fetch signal value. Error: %s", eina_error_msg_get(error));
+        if (error != EAGAIN) ERR("Failed to fetch signal value %s for property %s got error: %s", signal, fetch, eina_error_msg_get(error));
         return;
      }
 
@@ -2282,11 +2282,11 @@ _content_created(Eo *obj, void *data, const Eina_Value value)
    eina_value_get(&value, &content);
 
    // Recycle old content
-   old_content = elm_layout_content_get(obj, request->key);
+   old_content = efl_content_get(efl_part(obj, request->key));
    if (old_content) efl_ui_factory_release(request->factory, old_content);
 
    // Set new content
-   elm_layout_content_set(obj, request->key, content);
+   efl_content_set(efl_part(obj, request->key), content);
 
    return value;
 }
@@ -2444,11 +2444,11 @@ _efl_ui_layout_base_efl_ui_view_model_set(Eo *obj, Efl_Ui_Layout_Data *pd, Efl_M
         if (factory->in_flight) eina_future_cancel(factory->in_flight);
 
         // Cleanup content
-        content = elm_layout_content_get(obj, key);
-        elm_layout_content_set(obj, key, NULL);
+        content = efl_content_get(efl_part(obj, key));
+        efl_content_unset(efl_part(obj, key));
 
         // And recycle it
-        efl_ui_factory_release(factory->factory, content);
+        if (content) efl_ui_factory_release(factory->factory, content);
      }
    eina_iterator_free(it);
 
@@ -2534,8 +2534,8 @@ _efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui
         Efl_Gfx_Entity *old;
 
         // Unset and recycle
-        old = elm_layout_content_get(obj, ss_key);
-        elm_layout_content_set(obj, ss_key, NULL);
+        old = efl_content_get(efl_part(obj, ss_key));
+        efl_content_unset(efl_part(obj, ss_key));
         if (old) efl_ui_factory_release(tracking->factory, old);
 
         // Stop in flight request