efl/src/tests/efl_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
..
.gitignore
BasicDirection.cs csharp: Change to new class API. 2018-11-29 21:29:48 -02:00
Eina.cs efl-csharp: fix resource deallocation causing errors everywhere 2019-04-05 19:58:19 -03:00
EinaTestData.cs efl-mono: Share test data among other files. 2019-01-14 16:16:18 +09:00
Eldbus.cs efl_mono: Fix eldbus warnings and typo. 2018-05-17 16:56:18 -03:00
Eo.cs csharp: Refactor wrapper lifetime. 2019-05-31 17:44:12 -03:00
EoPromises.cs efl_app: introduce app_main for getting the app object 2018-12-20 12:56:54 +01:00
Errors.cs efl_mono: move Eina.Error.Init() to a static constructor 2019-01-16 14:24:12 +01:00
Events.cs csharp: Add some tests 2019-05-31 17:41:14 -03:00
FunctionPointerMarshalling.cs csharp: Change to new class API. 2018-11-29 21:29:48 -02:00
FunctionPointers.cs efl-csharp: fix resource deallocation causing errors everywhere 2019-04-05 19:58:19 -03:00
Inheritance.cs csharp: Refactor wrapper lifetime. 2019-05-31 17:44:12 -03:00
Main.cs csharp: Add some tests 2019-05-31 17:41:14 -03:00
Parts.cs csharp: Add Part suffix for the part wrappers 2019-05-07 13:53:39 +02:00
Promises.cs efl_app: introduce app_main for getting the app object 2018-12-20 12:56:54 +01:00
Strbuf.cs csharp: Change to new class API. 2018-11-29 21:29:48 -02:00
Strings.cs csharp: Change to new class API. 2018-11-29 21:29:48 -02:00
StructHelpers.cs efl-csharp: Remove generated inlist/inarray support 2019-02-28 12:21:56 -03:00
Structs.cs efl-mono: Share test data among other files. 2019-01-14 16:16:18 +09:00
TestUtils.cs csharp: Refactor wrapper lifetime. 2019-05-31 17:44:12 -03:00
Value.cs efl-csharp: Fix Eina.Value containing arrays and lists 2019-03-01 19:24:12 -03:00
ValueEolian.cs efl-mono: Add extra constructors to Eina.Value 2019-01-11 14:51:22 +01:00
dummy_child.c csharp: Split test files 2019-05-22 17:32:46 -03:00
dummy_child.eo efl-csharp: Respect beta in constructor parameters. 2019-03-07 13:03:33 +01:00
dummy_event_manager.c csharp: Add some tests 2019-05-31 17:41:14 -03:00
dummy_event_manager.eo csharp: Add some tests 2019-05-31 17:41:14 -03:00
dummy_inherit_helper.c csharp: Split test files 2019-05-22 17:32:46 -03:00
dummy_inherit_helper.eo efl-mono: Add proper test for interface inheritance 2019-01-17 21:36:27 +09:00
dummy_inherit_iface.eo efl-mono: Add proper test for interface inheritance 2019-01-17 21:36:27 +09:00
dummy_interfaces.c csharp: Split test files 2019-05-22 17:32:46 -03:00
dummy_numberwrapper.c csharp: Split test files 2019-05-22 17:32:46 -03:00
dummy_numberwrapper.eo csharp: Change to new class API. 2018-11-29 21:29:48 -02:00
dummy_part_holder.c csharp: Refactor wrapper lifetime. 2019-05-31 17:44:12 -03:00
dummy_part_holder.eo csharp: Refactor wrapper lifetime. 2019-05-31 17:44:12 -03:00
dummy_test_iface.eo csharp: Remove test about conflicting events. 2019-03-20 18:44:02 +01:00
dummy_test_object.c csharp: Split test files 2019-05-22 17:32:46 -03:00
dummy_test_object.eo csharp: Fix event marshalling for value types 2019-05-14 08:49:17 +02:00
efl-mono-suite.runtimeconfig.json efl-mono: Add support for dotnet core 2019-03-01 23:58:56 -03:00
libefl_mono_native_test.h csharp: Add some tests 2019-05-31 17:41:14 -03:00
meson.build csharp: Add some tests 2019-05-31 17:41:14 -03:00
mono_test_driver.sh efl_mono: fix test and example compilation on Windows 2017-12-15 22:26:30 -02:00