Revert "Eo: Remove eo_del() and make eo_unref() the replacement."
authorTom Hacohen <tom@stosb.com>
Wed, 1 Jun 2016 12:14:30 +0000 (13:14 +0100)
committerTom Hacohen <tom@stosb.com>
Wed, 1 Jun 2016 12:33:21 +0000 (13:33 +0100)
commita6a23389625a5c65747bc648424db18173f563b9
treef0c13bdb49c9211a90b9d2a034c2a4333b38af3e
parent466d9fbaf1319db4df9d576bdbe196f2557f6627
Revert "Eo: Remove eo_del() and make eo_unref() the replacement."

This reverts commit 546ff7bbba788ec834c5608361c0834853f2d5d7.

It seems that eo_del() is useful and removing it was creating bugs.
The issue is that the way we defined parents in eo, both the parent and
the programmer share a reference to the object. When we eo_unref() that
reference as the programmer, eo has no way to know it's this specific
reference we are freeing, and not a general one, so in some
circumstances, for example:
eo_ref(child);
eo_unref(child); // trying to delete here
eo_unref(container); // container is deleted here
eo_unref(child); // child already has 0 refs before this point.

We would have an issue with references and objects being freed too soon
and in general, issue with the references.

Having eo_del() solves that, because this one explicitly unparents if
there is a parent, meaning the reference ownership is explicitly taken
by the programmer.

eo_del() is essentially a convenience function around "check if has
parent, and if so unparent, otherwise, unref". Which should be used when
you want to delete an object although it has a parent, and is equivalent
to eo_unref() when it doesn't have one.
57 files changed:
src/bin/elementary/test_application_server.c
src/bin/elementary/test_task_switcher.c
src/bin/elementary/test_ui_grid.c
src/bin/elementary/test_win_plug.c
src/examples/ecore/ecore_audio_playback.c
src/examples/ecore/ecore_audio_to_ogg.c
src/examples/elementary/performance/graphical.c
src/lib/ecore/ecore.c
src/lib/ecore/ecore_exe.c
src/lib/ecore/ecore_main.c
src/lib/ecore/ecore_timer.c
src/lib/ecore_con/ecore_con.c
src/lib/ecore_con/ecore_con_eet.c
src/lib/ecore_con/ecore_con_local_win32.c
src/lib/ecore_con/ecore_con_url.c
src/lib/edje/edje_edit.c
src/lib/edje/edje_load.c
src/lib/edje/edje_multisense.c
src/lib/edje/edje_smart.c
src/lib/elementary/elc_ctxpopup.c
src/lib/elementary/elc_hoversel.c
src/lib/elementary/elc_multibuttonentry.c
src/lib/elementary/elm_app_client.c
src/lib/elementary/elm_app_server.c
src/lib/elementary/elm_atspi_bridge.c
src/lib/elementary/elm_colorselector.c
src/lib/elementary/elm_dayselector.c
src/lib/elementary/elm_diskselector.c
src/lib/elementary/elm_gengrid.c
src/lib/elementary/elm_genlist.c
src/lib/elementary/elm_list.c
src/lib/elementary/elm_menu.c
src/lib/elementary/elm_segment_control.c
src/lib/elementary/elm_slideshow.c
src/lib/elementary/elm_sys_notify.c
src/lib/elementary/elm_widget.c
src/lib/eo/Eo.h
src/lib/eo/eo.c
src/lib/eo/eo_base.eo
src/lib/eo/eo_base_class.c
src/lib/evas/canvas/efl_canvas_image.c
src/lib/evas/canvas/evas_image_legacy.c
src/lib/evas/canvas/evas_object_image.c
src/lib/evas/canvas/evas_object_main.c
src/lib/evas/canvas/evas_vg_node.c
src/lib/evas/filters/evas_filter.c
src/modules/evas/engines/gl_generic/evas_engine.c
src/modules/evas/engines/software_generic/evas_engine.c
src/tests/ecore/ecore_test_ecore_audio.c
src/tests/edje/edje_test_edje.c
src/tests/elementary/elm_test_atspi.c
src/tests/emotion/emotion_test_main-eo.c
src/tests/eo/children/children_main.c
src/tests/eo/suite/eo_test_class_behaviour_errors.c
src/tests/eo/suite/eo_test_general.c
src/tests/evas/evas_test_image.c
src/tests/evas/evas_test_mesh.c