Chromium Code Reviews| Index: sdk/lib/io/timer_impl.dart |
| diff --git a/sdk/lib/io/timer_impl.dart b/sdk/lib/io/timer_impl.dart |
| index 73c7cae1c12ccad966449f43d93515a138917c10..0fc1d899e9f045cd388da8dbc9c778c6536a6569 100644 |
| --- a/sdk/lib/io/timer_impl.dart |
| +++ b/sdk/lib/io/timer_impl.dart |
| @@ -50,6 +50,7 @@ class _Timer extends LinkedListEntry<_Timer> implements Timer { |
| bool get _repeating => _milliSeconds >= 0; |
| + bool get isActive => (_callback != null); |
|
floitsch
2013/07/02 11:27:19
Remove parenthesis.
zarah
2013/07/02 11:43:12
Done.
|
| // Cancels a set timer. The timer is removed from the timer list and if |
| // the given timer is the earliest timer the native timer is reset. |
| @@ -143,7 +144,12 @@ class _Timer extends LinkedListEntry<_Timer> implements Timer { |
| // one of the later timers which will set the callback to |
| // null. |
| if (timer._callback != null) { |
| - timer._callback(timer); |
| + var callback = timer._callback; |
| + if (!timer._repeating) { |
| + //Mark timer as inactive. |
| + timer._callback = null; |
| + } |
| + callback(timer); |
| // Re-insert repeating timer if not canceled. |
| if (timer._repeating && timer._callback != null) { |
| timer._advanceWakeupTime(); |