Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2019-08] [System] Make FileSystemWatcher backend non-static (#16926)
[2019-08] [System] Make FileSystemWatcher backend non-static The FileSystemWatcher `watcher` field is the backend IFileWatcher that's supposed to be used for the actual operations. Each backend has a `bool GetInstance (out watcher)` method that returns a singleton object, so each new instance of FileSystemWatcher gets the same IFileWatcher instance. (They will get different `watcher_handle` instances which are used by some backends to uniquely identify this FileSystemWatcher). However when the first FileSystemWatcher instance is `Dispose`d, it will set `watcher = null` which will prevent the remaining instances from calling watcher?.StopDispatching (watcher_handle); watcher?.Dispose (watcher_handle); which means that the backend won't properly cleanup resources for any other FSW instances that have other `watcher_handle` values. Addresses #16709 <!-- Thank you for your Pull Request! If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed. Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number --> Backport of #16922. /cc @steveisok @lambdageek
- Loading branch information