From 2ec09862e4f94230945f7700a0ae5de09577c11f Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 28 May 2012 00:24:37 +0200 Subject: [PATCH] unix, windows: set active flag on unref'd handles A logic bug in uv__handle_start() and uv__handle_stop() stopped the active flag from getting set (or unset) on unref'd handles. --- src/uv-common.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/uv-common.h b/src/uv-common.h index 7bf6db81..cede20ba 100644 --- a/src/uv-common.h +++ b/src/uv-common.h @@ -155,16 +155,14 @@ UNUSED static int uv__is_active(const uv_handle_t* h) { UNUSED static void uv__handle_start(uv_handle_t* h) { if (h->flags & UV__ACTIVE) return; - if (!(h->flags & UV__REF)) return; + if (h->flags & UV__REF) uv__active_handle_add(h); h->flags |= UV__ACTIVE; - uv__active_handle_add(h); } #define uv__handle_start(h) uv__handle_start((uv_handle_t*)(h)) UNUSED static void uv__handle_stop(uv_handle_t* h) { if (!(h->flags & UV__ACTIVE)) return; - if (!(h->flags & UV__REF)) return; - uv__active_handle_rm(h); + if (h->flags & UV__REF) uv__active_handle_rm(h); h->flags &= ~UV__ACTIVE; } #define uv__handle_stop(h) uv__handle_stop((uv_handle_t*)(h))