diff --git a/src/tests/efl_mono/Eo.cs b/src/tests/efl_mono/Eo.cs index be66f0842c..aa3565dd76 100644 --- a/src/tests/efl_mono/Eo.cs +++ b/src/tests/efl_mono/Eo.cs @@ -120,7 +120,7 @@ class TestEoInherit public static void inherited_collected() { var wref = CreateCollectableInherited(); - Test.CollectAndIterate(); + Test.CollectAndIterate(300, 10); Test.AssertNull(wref.Target); } diff --git a/src/tests/efl_mono/FunctionPointers.cs b/src/tests/efl_mono/FunctionPointers.cs index 4536704389..911e20ea38 100644 --- a/src/tests/efl_mono/FunctionPointers.cs +++ b/src/tests/efl_mono/FunctionPointers.cs @@ -171,9 +171,7 @@ class TestFunctionPointers // Should release the handle to the wrapper allocated when calling set_callback from C. obj.SetCallback(twice); - GC.Collect(); - GC.WaitForPendingFinalizers(); - Efl.App.AppMain.Iterate(); + Test.CollectAndIterate(300, 10); Test.Assert(obj.set_called, "set_callback override must have been called"); Test.Assert(!obj.invoke_called, "invoke_callback must not have been called"); diff --git a/src/tests/efl_mono/TestUtils.cs b/src/tests/efl_mono/TestUtils.cs index 21b8ec7794..bbc37b5e65 100644 --- a/src/tests/efl_mono/TestUtils.cs +++ b/src/tests/efl_mono/TestUtils.cs @@ -200,14 +200,17 @@ public static class Test /// Runs a number of garbage collections and iterate the main loop. /// The iteration is needed to make sure objects collected in the GC thread /// are efl_unref'd in the main thread. - public static void CollectAndIterate(int iterations=1000) + public static void CollectAndIterate(int iterations=1000, int global_iterations=1) { - for (int i = 0; i < iterations; i++) + for (int g = 0; g < global_iterations; ++g) { - System.GC.Collect(); + for (int i = 0; i < iterations; ++i) + { + System.GC.Collect(); + } + System.GC.WaitForPendingFinalizers(); + Efl.App.AppMain.Iterate(); } - System.GC.WaitForPendingFinalizers(); - Efl.App.AppMain.Iterate(); } }