summaryrefslogtreecommitdiff
path: root/src/tests/efl_mono/dummy_part_holder.eo
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-05-31 17:43:11 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-05-31 17:44:12 -0300
commitfcf5f1d2e2d9ce877d550dd3352bbd6e0527299e (patch)
tree419d1e22dddf6d9283ce05cd92817df1a6371fa9 /src/tests/efl_mono/dummy_part_holder.eo
parent937da0b12c5b2b07a173199078856c35becdb0e0 (diff)
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
Diffstat (limited to 'src/tests/efl_mono/dummy_part_holder.eo')
-rw-r--r--src/tests/efl_mono/dummy_part_holder.eo1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/tests/efl_mono/dummy_part_holder.eo b/src/tests/efl_mono/dummy_part_holder.eo
index d65fd12e5b..b95f1a5cdc 100644
--- a/src/tests/efl_mono/dummy_part_holder.eo
+++ b/src/tests/efl_mono/dummy_part_holder.eo
@@ -9,5 +9,6 @@ class @beta Dummy.Part_Holder extends Dummy.Test_Object implements Efl.Part {
9 implements { 9 implements {
10 Efl.Part.part_get; 10 Efl.Part.part_get;
11 Efl.Object.constructor; 11 Efl.Object.constructor;
12 Efl.Object.destructor;
12 } 13 }
13} 14}