summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_ecore_audio.c
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2016-06-01 13:14:30 +0100
committerTom Hacohen <tom@stosb.com>2016-06-01 13:33:21 +0100
commita6a23389625a5c65747bc648424db18173f563b9 (patch)
treef0c13bdb49c9211a90b9d2a034c2a4333b38af3e /src/tests/ecore/ecore_test_ecore_audio.c
parent466d9fbaf1319db4df9d576bdbe196f2557f6627 (diff)
Revert "Eo: Remove eo_del() and make eo_unref() the replacement."
This reverts commit 546ff7bbba788ec834c5608361c0834853f2d5d7. It seems that eo_del() is useful and removing it was creating bugs. The issue is that the way we defined parents in eo, both the parent and the programmer share a reference to the object. When we eo_unref() that reference as the programmer, eo has no way to know it's this specific reference we are freeing, and not a general one, so in some circumstances, for example: eo_ref(child); eo_unref(child); // trying to delete here eo_unref(container); // container is deleted here eo_unref(child); // child already has 0 refs before this point. We would have an issue with references and objects being freed too soon and in general, issue with the references. Having eo_del() solves that, because this one explicitly unparents if there is a parent, meaning the reference ownership is explicitly taken by the programmer. eo_del() is essentially a convenience function around "check if has parent, and if so unparent, otherwise, unref". Which should be used when you want to delete an object although it has a parent, and is equivalent to eo_unref() when it doesn't have one.
Diffstat (limited to 'src/tests/ecore/ecore_test_ecore_audio.c')
-rw-r--r--src/tests/ecore/ecore_test_ecore_audio.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/tests/ecore/ecore_test_ecore_audio.c b/src/tests/ecore/ecore_test_ecore_audio.c
index 2174f9a..480e5a2 100644
--- a/src/tests/ecore/ecore_test_ecore_audio.c
+++ b/src/tests/ecore/ecore_test_ecore_audio.c
@@ -83,8 +83,8 @@ START_TEST(ecore_test_ecore_audio_obj_pulse)
83 ecore_main_loop_begin(); 83 ecore_main_loop_begin();
84 fail_if(pulse_context_failed); 84 fail_if(pulse_context_failed);
85 85
86 eo_unref(out); 86 eo_del(out);
87 eo_unref(in); 87 eo_del(in);
88} 88}
89END_TEST 89END_TEST
90#endif 90#endif
@@ -100,7 +100,7 @@ static Eina_Bool
100_idle_del(void *data) 100_idle_del(void *data)
101{ 101{
102 Eo *in = data; 102 Eo *in = data;
103 eo_unref(in); 103 eo_del(in);
104 ecore_idler_add(_quit, NULL); 104 ecore_idler_add(_quit, NULL);
105 105
106 return EINA_FALSE; 106 return EINA_FALSE;
@@ -218,8 +218,8 @@ START_TEST(ecore_test_ecore_audio_obj_tone)
218 218
219 ecore_main_loop_begin(); 219 ecore_main_loop_begin();
220 220
221 eo_unref(in); 221 eo_del(in);
222 eo_unref(out); 222 eo_del(out);
223 223
224 //TODO: Compare and fail 224 //TODO: Compare and fail
225 ecore_file_remove(TESTS_BUILD_DIR"/tmp.wav"); 225 ecore_file_remove(TESTS_BUILD_DIR"/tmp.wav");
@@ -308,8 +308,8 @@ START_TEST(ecore_test_ecore_audio_obj_sndfile)
308 308
309 ecore_main_loop_begin(); 309 ecore_main_loop_begin();
310 310
311 eo_unref(in); 311 eo_del(in);
312 eo_unref(out); 312 eo_del(out);
313 313
314 //TODO: Compare and fail 314 //TODO: Compare and fail
315 ecore_file_remove(TESTS_BUILD_DIR"/tmp.wav"); 315 ecore_file_remove(TESTS_BUILD_DIR"/tmp.wav");
@@ -361,20 +361,20 @@ START_TEST(ecore_test_ecore_audio_obj_in_out)
361 fail_if(eina_list_count(in3) != 2); 361 fail_if(eina_list_count(in3) != 2);
362 fail_if(eina_list_data_get(in3) != in); 362 fail_if(eina_list_data_get(in3) != in);
363 363
364 eo_unref(in2); 364 eo_del(in2);
365 365
366 in3 = ecore_audio_obj_out_inputs_get(out); 366 in3 = ecore_audio_obj_out_inputs_get(out);
367 367
368 fail_if(eina_list_count(in3) != 1); 368 fail_if(eina_list_count(in3) != 1);
369 fail_if(eina_list_data_get(in3) != in); 369 fail_if(eina_list_data_get(in3) != in);
370 370
371 eo_unref(out); 371 eo_del(out);
372 372
373 out2 = ecore_audio_obj_in_output_get(in); 373 out2 = ecore_audio_obj_in_output_get(in);
374 374
375 fail_if(out2); 375 fail_if(out2);
376 376
377 eo_unref(in); 377 eo_del(in);
378} 378}
379END_TEST 379END_TEST
380 380
@@ -433,8 +433,8 @@ START_TEST(ecore_test_ecore_audio_obj_vio)
433 433
434 ecore_main_loop_begin(); 434 ecore_main_loop_begin();
435 435
436 eo_unref(out); 436 eo_del(out);
437 eo_unref(in); 437 eo_del(in);
438} 438}
439END_TEST 439END_TEST
440 440
@@ -533,7 +533,7 @@ START_TEST(ecore_test_ecore_audio_obj_in)
533 fail_if(buf[i] != 0x00); 533 fail_if(buf[i] != 0x00);
534 } 534 }
535 535
536 eo_unref(in); 536 eo_del(in);
537} 537}
538END_TEST 538END_TEST
539 539
@@ -581,7 +581,7 @@ START_TEST(ecore_test_ecore_audio_obj)
581 volume = ecore_audio_obj_volume_get(obj); 581 volume = ecore_audio_obj_volume_get(obj);
582 fail_if(volume != 0.5); 582 fail_if(volume != 0.5);
583 583
584 eo_unref(obj); 584 eo_del(obj);
585 } 585 }
586 586
587} 587}