efl/src/bindings/mono/eo_mono
Lucas Cavalcante de Sousa 117450e3fa C#: Update C# code-generation to use a new ICustomMarshaler in some string usages that were leaking
When `C` calls a function that return/has an out string and it was overwritten by `C#` inherit class the `C` portion
wasn't cleaning its copy. Now, when a `C` calls a `C#` delegate function, `Strings` that are `out` values or `return`
values use a new marshaler (specific to this case) that uses Eina short lived strings (`Eina_Slstr`) instead of
duplicating it with `strdup`, so at some point, the string passed to `C` is deleted.

To do so, a `direction_context` (a new `Context` at `generation_contexts.hh`) was created. It is only used when a C#
delegate is being called from C (so this context is only set in `function_definition.hh` and `property_definition.hh`,
where it is set to `native_to_manage` to indicate that it is a native call to a managed function).

When this `direction_context` is set and the `String` being marshaled is not marked with an `@move` tag and it is an
`out` or `return` value, the new `StringOutMarshaler` (implemented at `iwrapper.cs`) is used (instead of
`StringKeepOwnershipMarshaler`).

When marshaling a managed data to native this marshaler uses eina short lived string (`Eina_Slstr`) that will be
automatically deleted. This delete is bounded to "the loop of the current thread or until the clear function is called
explicitly" as said at `src/lib/eina/eina_slstr.h`.

Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br>
Differential Revision: https://phab.enlightenment.org/D11434
2020-03-23 14:18:16 -03:00
..
EoWrapper.cs eolian-mono: Make Get/Set internal for generated properties 2020-02-18 16:47:38 -03:00
FunctionWrapper.cs csharp: FunctionWrapper doc fixes 2019-10-30 12:43:17 +01:00
FunctionWrapper_Unix.cs csharp: FunctionWrapper doc fixes 2019-10-30 12:43:17 +01:00
FunctionWrapper_Windows.cs mono: encapsulate internal FunctionWrapper 2019-10-28 19:04:59 -03:00
NativeModule.cs mono: encapsulate internal NativeModule 2019-10-28 19:08:48 -03:00
NativeModule_Unix.cs mono: encapsulate internal NativeModule 2019-10-28 19:08:48 -03:00
NativeModule_Windows.cs mono: encapsulate internal NativeModule 2019-10-28 19:08:48 -03:00
WrapperSupervisor.cs mono: encapsulate internal iwrapper members 2019-10-29 12:23:13 -03:00
iwrapper.cs C#: Update C# code-generation to use a new ICustomMarshaler in some string usages that were leaking 2020-03-23 14:18:16 -03:00
meson.build csharp: Refactor wrapper lifetime. 2019-05-31 17:44:12 -03:00
workaround.cs eolian_mono: blacklist c-only internal APIs 2020-01-29 13:46:37 +09:00