summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-04-23 12:12:31 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-04-23 13:02:29 -0300
commite23914fce785730ac3b0a736c6555fe6cadaddf0 (patch)
tree5ec5853b7f6bccd427d8da8370461c994d45954c
parent0ebf41c003ea89f10c45ae7a2e53c68302c05103 (diff)
csharp: Fix test code memory handling
Summary: It was causing the test to crash when running in debug build. Also some minor fixes cleaning up stuff when exiting. Fixes T7792. Reviewers: segfaultxavi, vitor.sousa Reviewed By: segfaultxavi, vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7792 Differential Revision: https://phab.enlightenment.org/D8679
-rw-r--r--src/tests/efl_mono/dummy_test_object.eo1
-rw-r--r--src/tests/efl_mono/libefl_mono_native_test.c37
2 files changed, 30 insertions, 8 deletions
diff --git a/src/tests/efl_mono/dummy_test_object.eo b/src/tests/efl_mono/dummy_test_object.eo
index a50c70e2e6..b5436a636e 100644
--- a/src/tests/efl_mono/dummy_test_object.eo
+++ b/src/tests/efl_mono/dummy_test_object.eo
@@ -1412,6 +1412,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
1412 } 1412 }
1413 implements { 1413 implements {
1414 Efl.Object.constructor; 1414 Efl.Object.constructor;
1415 Efl.Object.destructor;
1415 Efl.Object.provider_find; 1416 Efl.Object.provider_find;
1416 Dummy.Test_Iface.emit_nonconflicted; 1417 Dummy.Test_Iface.emit_nonconflicted;
1417 Dummy.Test_Iface.iface_prop { get; set; } 1418 Dummy.Test_Iface.iface_prop { get; set; }
diff --git a/src/tests/efl_mono/libefl_mono_native_test.c b/src/tests/efl_mono/libefl_mono_native_test.c
index 17ef5065b2..52d9190994 100644
--- a/src/tests/efl_mono/libefl_mono_native_test.c
+++ b/src/tests/efl_mono/libefl_mono_native_test.c
@@ -162,6 +162,30 @@ _dummy_test_object_efl_object_constructor(Eo *obj, Dummy_Test_Object_Data *pd)
162 return obj; 162 return obj;
163} 163}
164 164
165static void
166_dummy_test_object_efl_object_destructor(Eo *obj, Dummy_Test_Object_Data *pd)
167{
168 if (pd->stored_value)
169 {
170 eina_value_free(pd->stored_value);
171 pd->stored_value = NULL;
172 }
173
174 if (pd->promise)
175 {
176 eina_promise_reject(pd->promise, ECANCELED);
177 pd->promise = NULL;
178 }
179
180 if (pd->list_for_accessor)
181 {
182 eina_list_free(pd->list_for_accessor);
183 pd->list_for_accessor = NULL;
184 }
185
186 efl_destructor(efl_super(obj, DUMMY_TEST_OBJECT_CLASS));
187}
188
165Efl_Object *_dummy_test_object_return_object(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd) 189Efl_Object *_dummy_test_object_return_object(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
166{ 190{
167 return obj; 191 return obj;
@@ -3700,11 +3724,11 @@ void _dummy_test_object_set_value_ptr_own(EINA_UNUSED Eo *obj, Dummy_Test_Object
3700 3724
3701void _dummy_test_object_set_value(EINA_UNUSED Eo *obj, Dummy_Test_Object_Data *pd, Eina_Value value) 3725void _dummy_test_object_set_value(EINA_UNUSED Eo *obj, Dummy_Test_Object_Data *pd, Eina_Value value)
3702{ 3726{
3703 if (pd->stored_value) { 3727 if (pd->stored_value)
3704 eina_value_free(pd->stored_value); 3728 eina_value_free(pd->stored_value);
3705 } else { 3729
3706 pd->stored_value = eina_value_new(EINA_VALUE_TYPE_INT); 3730 pd->stored_value = eina_value_new(EINA_VALUE_TYPE_INT);
3707 } 3731
3708 eina_value_copy(&value, pd->stored_value); 3732 eina_value_copy(&value, pd->stored_value);
3709} 3733}
3710 3734
@@ -3922,7 +3946,6 @@ int _dummy_test_object_dummy_test_iface_iface_prop_get(EINA_UNUSED const Eo *obj
3922 3946
3923Eo * _dummy_test_object_efl_object_provider_find(EINA_UNUSED const Eo *obj, Dummy_Test_Object_Data *pd, const Efl_Class *klass) 3947Eo * _dummy_test_object_efl_object_provider_find(EINA_UNUSED const Eo *obj, Dummy_Test_Object_Data *pd, const Efl_Class *klass)
3924{ 3948{
3925 EINA_LOG_ERR("klass: %p, NUMBERWRAPPER: %p", klass, DUMMY_NUMBERWRAPPER_CLASS);
3926 if (klass == DUMMY_NUMBERWRAPPER_CLASS) 3949 if (klass == DUMMY_NUMBERWRAPPER_CLASS)
3927 return pd->provider; 3950 return pd->provider;
3928 else if (klass == DUMMY_TEST_IFACE_INTERFACE) 3951 else if (klass == DUMMY_TEST_IFACE_INTERFACE)
@@ -3932,13 +3955,11 @@ Eo * _dummy_test_object_efl_object_provider_find(EINA_UNUSED const Eo *obj, Dumm
3932 3955
3933Efl_Object *_dummy_test_object_call_find_provider(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, const Efl_Class *type) 3956Efl_Object *_dummy_test_object_call_find_provider(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, const Efl_Class *type)
3934{ 3957{
3935 printf("CALLING FIND PROVIDER FROM C");
3936 return efl_provider_find(obj, type); 3958 return efl_provider_find(obj, type);
3937} 3959}
3938 3960
3939Efl_Object *_dummy_test_object_call_find_provider_for_iface(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd) 3961Efl_Object *_dummy_test_object_call_find_provider_for_iface(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
3940{ 3962{
3941 printf("CALLING FIND PROVIDER FROM C");
3942 return efl_provider_find(obj, DUMMY_TEST_IFACE_INTERFACE); 3963 return efl_provider_find(obj, DUMMY_TEST_IFACE_INTERFACE);
3943} 3964}
3944 3965