Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Windows: never call fs event callbacks after closing the watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Mar 27, 2012
1 parent aff0783 commit 1795427
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/win/fs-event.c
Expand Up @@ -301,6 +301,13 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
assert(handle->req_pending);
handle->req_pending = 0;

/* If we're closing, don't report any callbacks, and just push the handle */
/* onto the endgame queue. */
if (handle->flags & UV_HANDLE_CLOSING) {
uv_want_endgame(loop, (uv_handle_t*) handle);
return;
};

file_info = (FILE_NOTIFY_INFORMATION*)(handle->buffer + offset);

if (REQ_SUCCESS(req)) {
Expand Down Expand Up @@ -438,11 +445,9 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
}

offset = file_info->NextEntryOffset;
} while(offset);
} while (offset && !(handle->flags & UV_HANDLE_CLOSING));
} else {
if (!(handle->flags & UV_HANDLE_CLOSING)) {
handle->cb(handle, NULL, UV_CHANGE, 0);
}
handle->cb(handle, NULL, UV_CHANGE, 0);
}
} else {
uv__set_sys_error(loop, GET_REQ_ERROR(req));
Expand Down

0 comments on commit 1795427

Please sign in to comment.