bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=fba098df3824c287819b4ae6a9f980b99786c58c
commit fba098df3824c287819b4ae6a9f980b99786c58c Author: Yeongjong Lee <[email protected]> Date: Fri Nov 22 06:13:25 2019 +0000 eo: add move tag to iterator It is impossible to reuse iterator after `EINA_ITERATOR_FOREACH`(`eina_iterator_next`). E.g. ``` eina_init(); eina_file_dir_list("/home/", EINA_FALSE, _print_cb, NULL); it = eina_file_ls("/home/"); EINA_ITERATOR_FOREACH(it, f_name) { printf("%s\n", f_name); eina_stringshare_del(f_name); } EINA_ITERATOR_FOREACH(it, f_name) { printf("Again %s\n", f_name); eina_stringshare_del(f_name); } eina_iterator_free(it); ``` `Agian ...` is never printed. Therefore, iterator always need `@move` tag to avoid unexpected behavior without any error message. Reviewed-by: Marcel Hollerbach <[email protected]> Differential Revision: https://phab.enlightenment.org/D10719 --- src/lib/ecore/efl_boolean_model.eo | 2 +- src/lib/ecore/efl_core_env.eo | 2 +- src/lib/efl/interfaces/efl_gfx_image.eo | 4 ++-- src/lib/efl/interfaces/efl_ui_view_factory.eo | 2 +- src/lib/elementary/efl_access_object.eo | 2 +- src/lib/elementary/efl_ui_focus_manager.eo | 4 ++-- src/lib/elementary/efl_ui_view_model.c | 1 + src/lib/elementary/efl_ui_view_model.eo | 4 ++-- src/lib/elementary/efl_ui_win.eo | 2 +- 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/lib/ecore/efl_boolean_model.eo b/src/lib/ecore/efl_boolean_model.eo index f8ee356713..fa5b1405c0 100644 --- a/src/lib/ecore/efl_boolean_model.eo +++ b/src/lib/ecore/efl_boolean_model.eo @@ -25,7 +25,7 @@ class @beta Efl.Boolean_Model extends Efl.Composite_Model @in name: string; [[The name of the property to examine.]] @in request: bool; [[The value to look for.]] } - return: iterator<ptr(uint64)>; [[The iterator that is valid until any change is made on the model.]] + return: iterator<ptr(uint64)> @move; [[The iterator that is valid until any change is made on the model.]] } } implements { diff --git a/src/lib/ecore/efl_core_env.eo b/src/lib/ecore/efl_core_env.eo index 593a3a3cf5..c17e0a1440 100644 --- a/src/lib/ecore/efl_core_env.eo +++ b/src/lib/ecore/efl_core_env.eo @@ -47,7 +47,7 @@ class @beta Efl.Core.Env extends Efl.Object implements Efl.Duplicate { } values { - iter : iterator<string>; + iter : iterator<string> @move; } } } diff --git a/src/lib/efl/interfaces/efl_gfx_image.eo b/src/lib/efl/interfaces/efl_gfx_image.eo index 40ee6ed76f..b9d962b9ab 100644 --- a/src/lib/efl/interfaces/efl_gfx_image.eo +++ b/src/lib/efl/interfaces/efl_gfx_image.eo @@ -217,9 +217,9 @@ interface Efl.Gfx.Image } get {} values { - horizontal: iterator<Efl.Gfx.Image_Stretch_Region>(null); [[Representation of areas that are + horizontal: iterator<Efl.Gfx.Image_Stretch_Region>(null) @move; [[Representation of areas that are stretchable in the image horizontal space.]] - vertical: iterator<Efl.Gfx.Image_Stretch_Region>(null); [[Representation of areas that are + vertical: iterator<Efl.Gfx.Image_Stretch_Region>(null) @move; [[Representation of areas that are stretchable in the image vertical space.]] } } diff --git a/src/lib/efl/interfaces/efl_ui_view_factory.eo b/src/lib/efl/interfaces/efl_ui_view_factory.eo index 728c25907c..f4774300a5 100644 --- a/src/lib/efl/interfaces/efl_ui_view_factory.eo +++ b/src/lib/efl/interfaces/efl_ui_view_factory.eo @@ -10,7 +10,7 @@ class @beta Efl.Ui.View_Factory params { factory: Efl.Ui.Factory; [[The factory to use for requesting the new object from and generating the created event onto.]] - models: iterator<Efl.Model>; [[Efl iterator providing the model to be associated to the new item. It should + models: iterator<Efl.Model> @move; [[Efl iterator providing the model to be associated to the new item. It should remain valid until the end of the function call.]] } return: future<Efl.Gfx.Entity>; [[Created UI object]] diff --git a/src/lib/elementary/efl_access_object.eo b/src/lib/elementary/efl_access_object.eo index d7392f275e..fc16ea2194 100644 --- a/src/lib/elementary/efl_access_object.eo +++ b/src/lib/elementary/efl_access_object.eo @@ -263,7 +263,7 @@ mixin @beta Efl.Access.Object requires Efl.Object } relations_get @protected @beta @const { [[Gets an all relations between accessible object and other accessible objects.]] - return: iterator<ptr(Efl.Access.Relation)>; [[Accessible relation set]] + return: iterator<ptr(Efl.Access.Relation)> @move; [[Accessible relation set]] } @property role @beta { [[The role of the object in accessibility domain.]] diff --git a/src/lib/elementary/efl_ui_focus_manager.eo b/src/lib/elementary/efl_ui_focus_manager.eo index 1b0256f663..5bb11e7036 100644 --- a/src/lib/elementary/efl_ui_focus_manager.eo +++ b/src/lib/elementary/efl_ui_focus_manager.eo @@ -92,7 +92,7 @@ interface Efl.Ui.Focus.Manager { ]] get {} values { - border_elements : iterator<Efl.Ui.Focus.Object>; [[An iterator + border_elements : iterator<Efl.Ui.Focus.Object> @move; [[An iterator over the border objects.]] } } @@ -107,7 +107,7 @@ interface Efl.Ui.Focus.Manager { viewport : Eina.Rect; [[The rectangle defining the viewport.]] } values { - viewport_elements : iterator<Efl.Ui.Focus.Object>; [[An iterator over the viewport border objects.]] + viewport_elements : iterator<Efl.Ui.Focus.Object> @move; [[An iterator over the viewport border objects.]] } } @property root { diff --git a/src/lib/elementary/efl_ui_view_model.c b/src/lib/elementary/efl_ui_view_model.c index 0580ff7d41..0194e47a87 100644 --- a/src/lib/elementary/efl_ui_view_model.c +++ b/src/lib/elementary/efl_ui_view_model.c @@ -183,6 +183,7 @@ _efl_ui_view_model_property_logic_add(Eo *obj, Efl_Ui_View_Model_Data *pd, logic->sources = eina_list_append(logic->sources, eina_stringshare_add(source)); efl_ui_view_model_property_bind(obj, source, property); } + eina_iterator_free(bound); return 0; } diff --git a/src/lib/elementary/efl_ui_view_model.eo b/src/lib/elementary/efl_ui_view_model.eo index d296c8c4ae..d5dcdbeaf8 100644 --- a/src/lib/elementary/efl_ui_view_model.eo +++ b/src/lib/elementary/efl_ui_view_model.eo @@ -76,8 +76,8 @@ class Efl.Ui.View_Model extends Efl.Composite_Model with the above property name.]] set: EflUiViewModelPropertySet; [[Define the set callback called when the @Efl.Model.property.set is called with the above property name.]] - binded: iterator<string>; [[Iterator of property name to bind with this defined property see - @.property_bind.]] + binded: iterator<string> @move; [[Iterator of property name to bind with this defined property see + @.property_bind.]] } return: Eina.Error; } diff --git a/src/lib/elementary/efl_ui_win.eo b/src/lib/elementary/efl_ui_win.eo index bca1b4a574..602acf506b 100644 --- a/src/lib/elementary/efl_ui_win.eo +++ b/src/lib/elementary/efl_ui_win.eo @@ -721,7 +721,7 @@ class Efl.Ui.Win extends Efl.Ui.Widget implements Efl.Canvas.Scene, Efl.Access.W hover: bool @optional; [[$false by default, $true means to include fingers that are currently hovering.]] } - return: iterator<const(Efl.Input.Pointer)>; [[Iterator to pointer positions]] + return: iterator<const(Efl.Input.Pointer)> @move; [[Iterator to pointer positions]] } @property win_rotation @beta { [[The rotation of this window --
