Page MenuHomePhabricator

EFL# : Crash in iterator foreach which generated by Eina_List
Open, Incoming QueuePublic


Eina.Iterator can be enumerable with foreach in EFL#,
but some cases it crashed.

in box, we provide iterateContent API for iterating packed content,
but foreach Next failed with below message,

ERR<11683>:mono /home/sh10233lee/projects/upstream/efl_http/build/src/bindings/mono/efl_ui_button.eo.cs:148 ClickedEvent() System.Exception: Failed to get a suitable concrete class for this type.

at Eina.TraitFunctions.RegisterTypeTraits[T] () [0x00062] in <8fff3b07ac304c93ad70a3fd8e278d4a>:0 
at Eina.TraitFunctions.GetTypeTraits[T] () [0x0001b] in <8fff3b07ac304c93ad70a3fd8e278d4a>:0 
at Eina.TraitFunctions.NativeToManaged[T] (System.IntPtr nat) [0x00000] in <8fff3b07ac304c93ad70a3fd8e278d4a>:0 
at Eina.Iterator`1[T].Next (T& res) [0x00023] in <8fff3b07ac304c93ad70a3fd8e278d4a>:0 
at Eina.Iterator`1+<GetEnumerator>c__Iterator0[T].MoveNext () [0x00046] in <8fff3b07ac304c93ad70a3fd8e278d4a>:0 
at eflSharpTest.EflUiListView+<>c.<CreateBox>b__6_0 (System.Object o, Efl.Input.ClickableClickedEventArgs e) [0x00042] in /home/sh10233lee/Projects/eflSharpTest/eflSharpTest/Program.cs:106 
at Efl.Ui.Button+<>c__AnonStorey1.<>m__0 (System.IntPtr data, Efl.Event+NativeStruct& evt) [0x00033] in <8fff3b07ac304c93ad70a3fd8e278d4a>:0

here is sample code for this occasion.

private static Efl.Ui.Box CreateBox(Efl.Object parent)
    Efl.Ui.Box box = new Efl.Ui.Box(parent);
    box.Orientation = Efl.Ui.LayoutOrientation.Vertical;
    box.ContentPadding = (10, 10);
    Efl.Ui.Button btn;

    for (int i = 0; i < 10; i ++)
        btn = CreateBtn(box, i + "th button", i);
        if (i == 0)
            btn.ClickedEvent += (o, e) =>
                Eina.Iterator<Efl.Gfx.IEntity> itr = box.IterateContent();

                // Copy the iterator in local list.
                foreach (Efl.Gfx.IEntity content in itr)
                    System.Console.WriteLine("Iterate cotent ["+ content + "]");
    return box;         
felipealmeida added a subscriber: lauromoura.