efl/src/bin/eolian_mono/eolian/mono
Vitor Sousa fcf5f1d2e2 csharp: Refactor wrapper lifetime.
Summary:
This commit makes use of the `ownership,shared` and `ownership,unique`
events from Efl.Object in order to avoid the C# wrapper from being
collected while C code holds a reference to the object.

For example, creating a list of items in a for loop and attaching events to
them would fails without this commit, as the C# GC may collect the wrapper.

The basic idea is that we use a `WrapperSupervisor`, which is stored in
the Eo data storage, with a GCHandle allocated for the lifetime of the
underlying Eo object. This supervisor takes care of holding either a
weak C# reference (when in unique mode, allowing the wrapper to be GC'd)
or a hard C# reference (when in shared mode, making the wrapper
non-collectable while the Eo has extra references).

One limitation is that object graphs can leak if a shared object in the
graph - an Eo child for example - stores a hard reference to another
object in the graph as a C# field. In this example, this causes the
parent to always have a hard C# reference (from the child) as the child
is non-collectable due to the parent holding an Eo reference to it.

Depends on D8678

Test Plan: `ninja test` and `make test`

Reviewers: lauromoura, felipealmeida, woohyun, segfaultxavi

Reviewed By: lauromoura

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9014
2019-05-31 17:44:12 -03:00
..
alias_definition.hh csharp: Add docs for aliases 2019-05-03 16:22:09 +02:00
async_function_definition.hh csharp: Some docs improvements. 2019-05-03 13:59:11 +02:00
blacklist.hh csharp: Make classes abstract and rework casting 2019-04-05 19:56:42 -03:00
documentation.hh csharp: Fixes repeated method names. 2019-04-23 12:31:37 +02:00
enum_definition.hh csharp: Simple spacing rules changes 2019-04-22 18:04:31 -03:00
events.hh csharp: Refactor wrapper lifetime. 2019-05-31 17:44:12 -03:00
function_declaration.hh efl-mono: Enable selecting to build @beta items 2019-01-17 21:45:49 +09:00
function_definition.hh csharp: Refactor wrapper lifetime. 2019-05-31 17:44:12 -03:00
function_helpers.hh efl-mono: Only raise exception for managed errors. 2019-01-15 17:51:20 +09:00
function_pointer.hh csharp: Fix free_cb calling under dotnet. 2019-04-15 15:24:29 -03:00
function_registration.hh csharp: refactor native_inherit into a nested class. 2019-04-23 11:57:51 +02:00
generation_contexts.hh mono-docs: Allow derived classes to have external examples 2019-04-12 18:13:29 +02:00
helpers.hh eolian_csharp: add indentation context 2019-03-26 16:42:36 -03:00
klass.hh csharp: Refactor wrapper lifetime. 2019-05-31 17:44:12 -03:00
logging.hh efl_mono: More uniformization of the handling of names 2018-05-03 18:04:41 -03:00
marshall_annotation.hh csharp: Small style changes 2019-04-22 18:20:52 -03:00
marshall_type.hh efl-mono: Add support for dotnet core 2019-03-01 23:58:56 -03:00
marshall_type_impl.hh eolian_csharp: hide struct native representation inside the managed struct 2019-03-26 16:43:25 -03:00
name_helpers.hh csharp: Add Part suffix for the part wrappers 2019-05-07 13:53:39 +02:00
parameter.hh csharp: Small style changes 2019-04-22 18:20:52 -03:00
part_definition.hh csharp: Fix property helper doc indent 2019-05-06 13:45:58 +02:00
struct_definition.hh csharp: Fix property helper doc indent 2019-05-06 13:45:58 +02:00
struct_fields.hh csharp: Small style changes 2019-04-22 18:20:52 -03:00
type.hh eolian-mono: Provide constructor parameters based on the constructors 2019-02-01 14:03:02 -05:00
type_impl.hh efl-csharp: Remove spaces from type strings in generator. 2019-03-26 14:48:12 -03:00
using_decl.hh csharp: Change to new class API. 2018-11-29 21:29:48 -02:00
utils.hh csharp: Fix event names with underscore. 2019-03-11 19:28:02 -03:00
variable_definition.hh csharp: Some docs improvements. 2019-05-03 13:59:11 +02:00