mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
LibCore: Remove deleted monitored files before invoking change callbacks
The caller may want to re-add the monitored file. It won't be able to do so if we internally believe the file is still being monitored.
This commit is contained in:
parent
abc462999e
commit
574b4be433
Notes:
github-actions[bot]
2024-08-25 07:49:04 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/574b4be433b Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1182
1 changed files with 2 additions and 1 deletions
|
@ -111,7 +111,6 @@ FileWatcher::FileWatcher(int watcher_fd, NonnullRefPtr<Notifier> notifier)
|
|||
auto maybe_event = get_event_from_fd(m_notifier->fd(), m_wd_to_path);
|
||||
if (maybe_event.has_value()) {
|
||||
auto event = maybe_event.value();
|
||||
on_change(event);
|
||||
|
||||
if (has_flag(event.type, FileWatcherEvent::Type::Deleted)) {
|
||||
auto result = remove_watch(event.event_path);
|
||||
|
@ -119,6 +118,8 @@ FileWatcher::FileWatcher(int watcher_fd, NonnullRefPtr<Notifier> notifier)
|
|||
dbgln_if(FILE_WATCHER_DEBUG, "on_ready_to_read: {}", result.error());
|
||||
}
|
||||
}
|
||||
|
||||
on_change(event);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue