From: cedric Date: Wed, 17 Sep 2008 08:33:35 +0000 (+0000) Subject: Fix bug reported by Vincent Torri and add a test to trigger it. X-Git-Tag: submit/2.0alpha-wayland/20121127.222009~1900 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0984ad070fcffa74f456701ac8ce4b7d31209f48;p=profile%2Fivi%2Feina.git Fix bug reported by Vincent Torri and add a test to trigger it. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/PROTO/eina@36041 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/eina_counter.c b/src/lib/eina_counter.c index 7d90461..ae7c914 100644 --- a/src/lib/eina_counter.c +++ b/src/lib/eina_counter.c @@ -198,7 +198,7 @@ eina_counter_stop(Eina_Counter *counter, int specimen) clk = (Eina_Clock *) counter->clocks; - if (clk->valid == EINA_TRUE) return ; + if (!clk || clk->valid == EINA_TRUE) return ; clk->end = tp; clk->specimen = specimen; diff --git a/src/tests/eina_test_counter.c b/src/tests/eina_test_counter.c index aa6739a..b4c7261 100644 --- a/src/tests/eina_test_counter.c +++ b/src/tests/eina_test_counter.c @@ -66,9 +66,27 @@ START_TEST(eina_counter_simple) } END_TEST +START_TEST(eina_counter_break) +{ + Eina_Counter *cnt; + + eina_counter_init(); + + cnt = eina_counter_add("eina_test"); + fail_if(!cnt); + + eina_counter_stop(cnt, 10); + + eina_counter_delete(cnt); + + eina_counter_shutdown(); +} +END_TEST + void eina_test_counter(TCase *tc) { tcase_add_test(tc, eina_counter_init_shutdown); tcase_add_test(tc, eina_counter_simple); + tcase_add_test(tc, eina_counter_break); }