aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/efl_mono/libefl_mono_native_test.c
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/tests/efl_mono/libefl_mono_native_test.c
parentcsharp: Make classes abstract and rework casting (diff)
downloadefl-1c22a3d8190fd85570418a076356547f3eda606f.tar.gz
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 https://phab.enlightenment.org/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/tests/efl_mono/libefl_mono_native_test.c')
-rw-r--r--src/tests/efl_mono/libefl_mono_native_test.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/tests/efl_mono/libefl_mono_native_test.c b/src/tests/efl_mono/libefl_mono_native_test.c
index 8575ebac9c..17ef5065b2 100644
--- a/src/tests/efl_mono/libefl_mono_native_test.c
+++ b/src/tests/efl_mono/libefl_mono_native_test.c
@@ -3640,12 +3640,11 @@ Dummy_StructComplex* _dummy_test_object_struct_complex_ptr_return_own(EINA_UNUSE
}
// //
-// Class constructor
+// Class methods
// //
EOLIAN static void
-_dummy_test_object_class_constructor(Efl_Class *klass)
+_dummy_test_object_create_cmp_array_objects(void)
{
- (void)klass;
modified_seq_obj[0] = base_seq_obj[0] = _new_obj(0x0);
modified_seq_obj[1] = base_seq_obj[1] = _new_obj(0x2A);
modified_seq_obj[2] = base_seq_obj[2] = _new_obj(0x42);
@@ -3655,11 +3654,8 @@ _dummy_test_object_class_constructor(Efl_Class *klass)
}
EOLIAN static void
-_dummy_test_object_class_destructor(Efl_Class *klass)
+_dummy_test_object_destroy_cmp_array_objects(void)
{
- (void)klass;
- for (unsigned i = 0; i < base_seq_obj_size; ++i)
- efl_unref(base_seq_obj[i]);
for (unsigned i = 0; i < modified_seq_obj_size; ++i)
efl_unref(modified_seq_obj[i]);
}