| Index: base/files/file_path_watcher_linux.cc
|
| diff --git a/base/files/file_path_watcher_linux.cc b/base/files/file_path_watcher_linux.cc
|
| index 2444b4453db2ce76c3745c1ec686efd991f29397..bd9503fc3b25549f4d37668d63739ab8febf541c 100644
|
| --- a/base/files/file_path_watcher_linux.cc
|
| +++ b/base/files/file_path_watcher_linux.cc
|
| @@ -513,6 +513,8 @@ void FilePathWatcherImpl::UpdateWatches() {
|
| void FilePathWatcherImpl::UpdateRecursiveWatches(
|
| InotifyReader::Watch fired_watch,
|
| bool is_dir) {
|
| + DCHECK(HasValidWatchVector());
|
| +
|
| if (!recursive_)
|
| return;
|
|
|
| @@ -523,7 +525,8 @@ void FilePathWatcherImpl::UpdateRecursiveWatches(
|
|
|
| // Check to see if this is a forced update or if some component of |target_|
|
| // has changed. For these cases, redo the watches for |target_| and below.
|
| - if (!ContainsKey(recursive_paths_by_watch_, fired_watch)) {
|
| + if (!ContainsKey(recursive_paths_by_watch_, fired_watch) &&
|
| + fired_watch != watches_.back().watch) {
|
| UpdateRecursiveWatchesForPath(target_);
|
| return;
|
| }
|
| @@ -532,7 +535,10 @@ void FilePathWatcherImpl::UpdateRecursiveWatches(
|
| if (!is_dir)
|
| return;
|
|
|
| - const FilePath& changed_dir = recursive_paths_by_watch_[fired_watch];
|
| + const FilePath& changed_dir =
|
| + ContainsKey(recursive_paths_by_watch_, fired_watch) ?
|
| + recursive_paths_by_watch_[fired_watch] :
|
| + target_;
|
|
|
| std::map<FilePath, InotifyReader::Watch>::iterator start_it =
|
| recursive_watches_by_path_.lower_bound(changed_dir);
|
|
|