Skip to content

Commit d26153e

Browse files
author
Will
committed
adapter/darwin: prevent de-duplication of create events from interfering with other types of events
1 parent 3eb9068 commit d26153e

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

devel/include/detail/wtr/watcher/adapter/darwin/watch.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,9 @@ inline auto event_recv_one(ContextData& ctx, char const* path, unsigned flags)
102102
}
103103
if (flags & fsev_flag_effect_remove) {
104104
auto at = ctx.seen_created_paths->find(path);
105-
if (at != ctx.seen_created_paths->end()) {
105+
if (at != ctx.seen_created_paths->end())
106106
ctx.seen_created_paths->erase(at);
107-
ctx.callback({path, ety::destroy, pt});
108-
}
107+
ctx.callback({path, ety::destroy, pt});
109108
}
110109
if (flags & fsev_flag_effect_modify) {
111110
ctx.callback({path, ety::modify, pt});
@@ -136,6 +135,9 @@ inline auto event_recv_one(ContextData& ctx, char const* path, unsigned flags)
136135
rename events, see this directory's
137136
notes (in the `notes.md` file).
138137
*/
138+
auto at = ctx.seen_created_paths->find(path);
139+
if (at != ctx.seen_created_paths->end())
140+
ctx.seen_created_paths->erase(at);
139141
auto lr_path = *ctx.last_rename_path;
140142
auto differs = ! lr_path.empty() && lr_path != path;
141143
auto missing = access(lr_path.c_str(), F_OK) == -1;

include/wtr/watcher.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,10 +582,9 @@ inline auto event_recv_one(ContextData& ctx, char const* path, unsigned flags)
582582
}
583583
if (flags & fsev_flag_effect_remove) {
584584
auto at = ctx.seen_created_paths->find(path);
585-
if (at != ctx.seen_created_paths->end()) {
585+
if (at != ctx.seen_created_paths->end())
586586
ctx.seen_created_paths->erase(at);
587-
ctx.callback({path, ety::destroy, pt});
588-
}
587+
ctx.callback({path, ety::destroy, pt});
589588
}
590589
if (flags & fsev_flag_effect_modify) {
591590
ctx.callback({path, ety::modify, pt});
@@ -616,6 +615,9 @@ inline auto event_recv_one(ContextData& ctx, char const* path, unsigned flags)
616615
rename events, see this directory's
617616
notes (in the `notes.md` file).
618617
*/
618+
auto at = ctx.seen_created_paths->find(path);
619+
if (at != ctx.seen_created_paths->end())
620+
ctx.seen_created_paths->erase(at);
619621
auto lr_path = *ctx.last_rename_path;
620622
auto differs = ! lr_path.empty() && lr_path != path;
621623
auto missing = access(lr_path.c_str(), F_OK) == -1;

0 commit comments

Comments
 (0)