Merge pull request #1651 from tznind/dispose-all-watchers

Dispose `FileSystemWatcher` instance before creating another in `FileDialog`
This commit is contained in:
Tig Kindel
2022-04-07 09:09:10 -07:00
committed by GitHub

View File

@@ -51,6 +51,10 @@ namespace Terminal.Gui {
bool valid = false;
try {
dirInfo = new DirectoryInfo (value == null ? directory.ToString () : value.ToString ());
// Dispose of the old watcher
watcher?.Dispose ();
watcher = new FileSystemWatcher (dirInfo.FullName);
watcher.NotifyFilter = NotifyFilters.Attributes
| NotifyFilters.CreationTime