summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-05-06 16:32:10 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-05-07 13:55:18 -0300
commit6d43adaaf4f194dbac6e79853ef79ed76095208e (patch)
tree93fc585bd4039d1fcc921dc1afa1f283dce22464 /src/tests
parentba1e70278e8f5405486fcab622c0ee81c136b771 (diff)
eina: Fix memory leaks in promise
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/ecore/ecore_test_promise.c2
-rw-r--r--src/tests/eina/eina_test_promise.c27
2 files changed, 23 insertions, 6 deletions
diff --git a/src/tests/ecore/ecore_test_promise.c b/src/tests/ecore/ecore_test_promise.c
index f137d65..5a54281 100644
--- a/src/tests/ecore/ecore_test_promise.c
+++ b/src/tests/ecore/ecore_test_promise.c
@@ -378,7 +378,7 @@ START_TEST(ecore_test_promise_progress_promise)
378 378
379 ecore_thread_promise_run(&promise_progress_thread, NULL, NULL, 0, &promise); 379 ecore_thread_promise_run(&promise_progress_thread, NULL, NULL, 0, &promise);
380 380
381 eina_promise_progress_cb_add(promise, &_progress_callback, NULL); 381 eina_promise_progress_cb_add(promise, &_progress_callback, NULL, NULL);
382 382
383 ecore_main_loop_begin(); 383 ecore_main_loop_begin();
384 384
diff --git a/src/tests/eina/eina_test_promise.c b/src/tests/eina/eina_test_promise.c
index f21f5ff..59199e1 100644
--- a/src/tests/eina/eina_test_promise.c
+++ b/src/tests/eina/eina_test_promise.c
@@ -226,7 +226,7 @@ START_TEST(eina_test_promise_progress)
226 owner = eina_promise_default_add(0); 226 owner = eina_promise_default_add(0);
227 227
228 promise = eina_promise_owner_promise_get(owner); 228 promise = eina_promise_owner_promise_get(owner);
229 eina_promise_progress_cb_add(promise, &progress_callback, &progress_ran); 229 eina_promise_progress_cb_add(promise, &progress_callback, &progress_ran, NULL);
230 230
231 eina_promise_owner_progress(owner, &i); 231 eina_promise_owner_progress(owner, &i);
232 232
@@ -254,8 +254,8 @@ START_TEST(eina_test_promise_progress_notify1)
254 eina_promise_owner_progress_notify(owner, &progress_notify, &progress_notify_ran, NULL); 254 eina_promise_owner_progress_notify(owner, &progress_notify, &progress_notify_ran, NULL);
255 255
256 promise = eina_promise_owner_promise_get(owner); 256 promise = eina_promise_owner_promise_get(owner);
257 eina_promise_progress_cb_add(promise, &progress_callback, NULL); // never run 257 eina_promise_progress_cb_add(promise, &progress_callback, NULL, NULL); // never run
258 eina_promise_progress_cb_add(promise, &progress_callback, NULL); // never run 258 eina_promise_progress_cb_add(promise, &progress_callback, NULL, NULL); // never run
259 259
260 ck_assert(progress_notify_ran); 260 ck_assert(progress_notify_ran);
261 261
@@ -311,8 +311,8 @@ START_TEST(eina_test_promise_progress_notify3)
311 &_eina_promise_progress_notify_error, &progress_notify_ran); 311 &_eina_promise_progress_notify_error, &progress_notify_ran);
312 312
313 promise = eina_promise_owner_promise_get(owner); 313 promise = eina_promise_owner_promise_get(owner);
314 eina_promise_progress_cb_add(promise, &progress_callback, NULL); // never run 314 eina_promise_progress_cb_add(promise, &progress_callback, NULL, NULL); // never run
315 eina_promise_progress_cb_add(promise, &progress_callback, NULL); // never run 315 eina_promise_progress_cb_add(promise, &progress_callback, NULL, NULL); // never run
316 316
317 ck_assert(progress_notify_ran); 317 ck_assert(progress_notify_ran);
318 318
@@ -320,6 +320,22 @@ START_TEST(eina_test_promise_progress_notify3)
320} 320}
321END_TEST 321END_TEST
322 322
323START_TEST(eina_test_promise_ignored)
324{
325 Eina_Promise_Owner* owner;
326 Eina_Promise* promise;
327
328 eina_init();
329
330 owner = eina_promise_default_add(0);
331 promise = eina_promise_owner_promise_get(owner);
332 eina_promise_unref(promise);
333 eina_promise_owner_value_set(owner, NULL, NULL);
334
335 eina_shutdown();
336}
337END_TEST
338
323void 339void
324eina_test_promise(TCase *tc) 340eina_test_promise(TCase *tc)
325{ 341{
@@ -333,4 +349,5 @@ eina_test_promise(TCase *tc)
333 tcase_add_test(tc, eina_test_promise_progress_notify1); 349 tcase_add_test(tc, eina_test_promise_progress_notify1);
334 tcase_add_test(tc, eina_test_promise_progress_notify2); 350 tcase_add_test(tc, eina_test_promise_progress_notify2);
335 tcase_add_test(tc, eina_test_promise_progress_notify3); 351 tcase_add_test(tc, eina_test_promise_progress_notify3);
352 tcase_add_test(tc, eina_test_promise_ignored);
336} 353}