Page MenuHomePhabricator

efl-mono: examples initialized with Components.Basic fail to run
Closed, ResolvedPublic

Description

Build the Core Events tutorial:
https://git.enlightenment.org/tools/examples.git/tree/reference/csharp/core/src/core_event.cs
It currently initializes UI components, but it does not have to, so change the last line to:

example.Launch(Efl.Csharp.Components.Basic);

After this change, the program does not run anymore. It prints this:

CRI<50219>: ../src/lib/eina/eina_share_common.c:559 _eina_share_common_node_from_str() *** Eina Magic Check Failed at 0x55953ad2440c !!!
    Input handle is wrong type.
    Expected: 98761254 - Eina Stringshare Node
    Supplied: 00005595 - (unknown)


CRI<50219>:eina_stringshare ../src/lib/eina/eina_stringshare.c:573 eina_stringshare_del() EEEK trying to del non-shared stringshare "/home/xartigas/repos/examples/build-debug/subprojects/csharp-core/src/efl_reference_core_event.exe"

And locks up.

segfaultxavi triaged this task as High priority.

A guess into the blue, is it possible that in efl_csharp_application.cs:102 the command line args are not stringshares, but ecore expects stringshares ? (This was changed at some point, and c# was likely not adjusted)

The problem is with the marshalling of array<stringshare>, which is the value expected by CommandLine.SetCommandArray. It is being generated as Eina.Array<System.String>. While we don't expect C# users to deal with stringshares directly, they should be marshalled correctly instead of just being passed to C.

It works with UI because elm_init does this call for us and when we call, it never tries to use the strings as stringshare.

The stringshare check has been fixed with the last string changes but the lock still remains.

It is caused by ecore_init_ex not being called and thus not registering the app callbacks what would initialize the Csharp.Application (like what EFL_MAIN() does in C). @brunobelo is adding it in a patch.

Thanks! I'll update the examples that do not need UI to work.

@segfaultxavi it's done in D9915 and D9916. I think all examples that it don't use UI is updated.

Oh, sorry, I had not realized these patches existed and I already pushed some of the fixes. Anyway, landed the rest now. Thanks!