summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2009-11-19 19:08:47 +0100
committerRyan Dahl <ry@tinyclouds.org>2009-11-19 19:08:47 +0100
commit686bec4f35844dde840bf029f1428378b654f9ab (patch)
tree16a6d2fc56cb96240ae964f71a919995a1e1db44 /src
parent0b441462ab626cc7e582921b54143a22dbe896d1 (diff)
downloadnode-new-686bec4f35844dde840bf029f1428378b654f9ab.tar.gz
Only detach timers when active.
Diffstat (limited to 'src')
-rw-r--r--src/node_timer.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/node_timer.cc b/src/node_timer.cc
index c9e8e7abf6..841f26c550 100644
--- a/src/node_timer.cc
+++ b/src/node_timer.cc
@@ -108,7 +108,9 @@ Handle<Value>
Timer::Stop (const Arguments& args)
{
Timer *timer = ObjectWrap::Unwrap<Timer>(args.Holder());
- ev_timer_stop(EV_DEFAULT_UC_ &timer->watcher_);
- timer->Detach();
+ if (ev_is_active(&timer->watcher_)) {
+ ev_timer_stop(EV_DEFAULT_UC_ &timer->watcher_);
+ timer->Detach();
+ }
return Undefined();
}