summaryrefslogtreecommitdiff
path: root/src/bindings/mono/eina_mono/eina_list.cs
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-04-05 19:57:29 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-04-05 19:58:19 -0300
commit1c22a3d8190fd85570418a076356547f3eda606f (patch)
treec22410a67a3b7263b495ce9ae0ae24d5e8b1daf9 /src/bindings/mono/eina_mono/eina_list.cs
parent1e22db1150049e313bcba7906fc5ffc9a745eaf0 (diff)
efl-csharp: fix resource deallocation causing errors everywhere
Summary: This commit mainly fixes errors caused by deallocating resources in the garbage collector thread. Using `ecore_main_loop_thread_safe_call_async` to queue resource deallocation in the main thread seems to solve it. Also, some `efl_ref` calls are added in places they were missing, mainly objects that unref in the destructor thus taking ownership if efl_ref is not called. Also fix improper resource deallocation in tests that were causing it to crash, enabling it to call Efl.All.Shutdown again. This allocation and the deallocation process was moved from the Eo class constructor to static class methods that are called in the test 'set up' and 'tear down' methods. Queuing resource deallocation in the main thread make it mandatory that tests call `Efl.App.AppMain.Iterate()` if they want to check proper resource deallocation (like TestFunctionPointers.set_callback_inherited_called_from_c). Extras: Remove duplicated declaration of 'eflcustomexportsmono' in meson in order to fix some linking problems. Remove some unused code around deallocation functions that had to be reworked. Object allocation is now supplied with the call site information it expects (file name and line for _efl_add_start). Depends on D8550 Test Plan: meson test Reviewers: felipealmeida, lauromoura, cedric, segfaultxavi Reviewed By: lauromoura Subscribers: segfaultxavi Tags: #efl_language_bindings, #do_not_merge Differential Revision: https://phab.enlightenment.org/D8431
Diffstat (limited to 'src/bindings/mono/eina_mono/eina_list.cs')
-rw-r--r--src/bindings/mono/eina_mono/eina_list.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/bindings/mono/eina_mono/eina_list.cs b/src/bindings/mono/eina_mono/eina_list.cs
index fe95650..4b9e5f5 100644
--- a/src/bindings/mono/eina_mono/eina_list.cs
+++ b/src/bindings/mono/eina_mono/eina_list.cs
@@ -45,6 +45,8 @@ public static class ListNativeFunctions
45 eina_list_move_list(ref IntPtr to, ref IntPtr from, IntPtr data); 45 eina_list_move_list(ref IntPtr to, ref IntPtr from, IntPtr data);
46 [DllImport(efl.Libs.Eina)] public static extern IntPtr 46 [DllImport(efl.Libs.Eina)] public static extern IntPtr
47 eina_list_free(IntPtr list); 47 eina_list_free(IntPtr list);
48 [DllImport(efl.Libs.CustomExports)] public static extern void
49 efl_mono_thread_safe_eina_list_free(IntPtr list);
48 [DllImport(efl.Libs.Eina)] public static extern IntPtr 50 [DllImport(efl.Libs.Eina)] public static extern IntPtr
49 eina_list_nth(IntPtr list, uint n); 51 eina_list_nth(IntPtr list, uint n);
50 [DllImport(efl.Libs.Eina)] public static extern IntPtr 52 [DllImport(efl.Libs.Eina)] public static extern IntPtr
@@ -190,7 +192,14 @@ public class List<T> : IEnumerable<T>, IDisposable
190 192
191 if (Own) 193 if (Own)
192 { 194 {
193 eina_list_free(h); 195 if (disposing)
196 {
197 eina_list_free(h);
198 }
199 else
200 {
201 efl_mono_thread_safe_eina_list_free(h);
202 }
194 } 203 }
195 } 204 }
196 205