[System.IO.KeventWatcher] Disable the watcher when the root directory is deleted...
authorAlexis Christoforides <alexis@thenull.net>
Tue, 2 Jun 2015 03:06:31 +0000 (23:06 -0400)
committerAlexis Christoforides <alexis@thenull.net>
Tue, 2 Jun 2015 03:07:07 +0000 (23:07 -0400)
This matches MS.NET behavior.

mcs/class/System/System.IO/KeventWatcher.cs

index 2eb2cd34a53cbf4051c279acc2696a3e4d740f45..7f8a2b50305ae6de5094b7472a0d360d00105333 100644 (file)
@@ -274,7 +274,6 @@ namespace System.IO {
                                        started = false;
                                        inDispatch = false;
                                        fsw.EnableRaisingEvents = false;
-                                       throw exc;
                                }
                                if (exc != null)
                                        fsw.DispatchErrorEvents (new ErrorEventArgs (exc));
@@ -382,6 +381,10 @@ namespace System.IO {
                                        }
                                                
                                        if ((kevt.fflags & FilterFlags.VNodeDelete) == FilterFlags.VNodeDelete || (kevt.fflags & FilterFlags.VNodeRevoke) == FilterFlags.VNodeRevoke) {
+                                               if (pathData.Path == fullPathNoLastSlash)
+                                                       //The root path is deleted; exit silently
+                                                       return;
+                                                               
                                                removeQueue.Add (pathData);
                                                continue;
                                        }