Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kliger (λgeek) <alklig@microsoft.com>2019-09-20 18:21:30 +0300
committerSteve Pfister <steveisok@users.noreply.github.com>2019-09-20 18:21:30 +0300
commit3757a7296c9cd700f9eceb8a9460a2de44e7cc01 (patch)
treeb01cfb34aebebe5e0d2e58a25182417a56e34d9d /mcs/class/System/System.IO/FileSystemWatcher.cs
parent95d17b16a86e23cb98892c6279679800106917ec (diff)
[System] Make FileSystemWatcher backend non-static (#16922)
* [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 https://github.com/mono/mono/issues/16709
Diffstat (limited to 'mcs/class/System/System.IO/FileSystemWatcher.cs')
-rw-r--r--mcs/class/System/System.IO/FileSystemWatcher.cs2
1 files changed, 1 insertions, 1 deletions
diff --git a/mcs/class/System/System.IO/FileSystemWatcher.cs b/mcs/class/System/System.IO/FileSystemWatcher.cs
index 9c003a80e5a..cbf71e7a9a6 100644
--- a/mcs/class/System/System.IO/FileSystemWatcher.cs
+++ b/mcs/class/System/System.IO/FileSystemWatcher.cs
@@ -61,7 +61,7 @@ namespace System.IO {
SearchPattern2 pattern;
bool disposed;
string mangledFilter;
- static IFileWatcher watcher;
+ IFileWatcher watcher;
object watcher_handle;
static object lockobj = new object ();