Merge branch 'v0.8'

This commit is contained in:
Ben Noordhuis 2012-12-14 12:07:31 +01:00
commit c6c5b7a901
3 changed files with 34 additions and 1 deletions

View File

@ -376,7 +376,7 @@ int uv_fs_event_init(uv_loop_t* loop,
void uv__fs_event_close(uv_fs_event_t* handle) {
if (handle->fd == PORT_FIRED) {
if (handle->fd == PORT_FIRED || handle->fd == PORT_LOADED) {
port_dissociate(handle->loop->fs_fd, PORT_SOURCE_FILE, (uintptr_t)&handle->fo);
}
handle->fd = PORT_DELETED;

View File

@ -296,6 +296,37 @@ TEST_IMPL(fs_event_watch_file_current_dir) {
return 0;
}
TEST_IMPL(fs_event_no_callback_after_close) {
uv_loop_t* loop = uv_default_loop();
int r;
/* Setup */
remove("watch_dir/file1");
remove("watch_dir/");
create_dir(loop, "watch_dir");
create_file(loop, "watch_dir/file1");
r = uv_fs_event_init(loop,
&fs_event,
"watch_dir/file1",
fs_event_cb_file,
0);
ASSERT(r != -1);
uv_close((uv_handle_t*)&fs_event, close_cb);
touch_file(loop, "watch_dir/file1");
uv_run(loop);
ASSERT(fs_event_cb_called == 0);
ASSERT(close_cb_called == 1);
/* Cleanup */
remove("watch_dir/file1");
remove("watch_dir/");
MAKE_VALGRIND_HAPPY();
return 0;
}
TEST_IMPL(fs_event_no_callback_on_close) {
uv_loop_t* loop = uv_default_loop();

View File

@ -177,6 +177,7 @@ TEST_DECLARE (fs_event_watch_dir)
TEST_DECLARE (fs_event_watch_file)
TEST_DECLARE (fs_event_watch_file_twice)
TEST_DECLARE (fs_event_watch_file_current_dir)
TEST_DECLARE (fs_event_no_callback_after_close)
TEST_DECLARE (fs_event_no_callback_on_close)
TEST_DECLARE (fs_event_immediate_close)
TEST_DECLARE (fs_event_close_with_pending_event)
@ -450,6 +451,7 @@ TASK_LIST_START
TEST_ENTRY (fs_event_watch_file)
TEST_ENTRY (fs_event_watch_file_twice)
TEST_ENTRY (fs_event_watch_file_current_dir)
TEST_ENTRY (fs_event_no_callback_after_close)
TEST_ENTRY (fs_event_no_callback_on_close)
TEST_ENTRY (fs_event_immediate_close)
TEST_ENTRY (fs_event_close_with_pending_event)