diff --git a/SparkleShare/Mac/SparkleMacController.cs b/SparkleShare/Mac/SparkleMacController.cs index 37ea6e7b..02ba8954 100644 --- a/SparkleShare/Mac/SparkleMacController.cs +++ b/SparkleShare/Mac/SparkleMacController.cs @@ -145,5 +145,12 @@ namespace SparkleShare { return html; } } + + + new public void Quit () + { + this.watcher.Dispose (); + base.Quit (); + } } } diff --git a/SparkleShare/Mac/SparkleMacWatcher.cs b/SparkleShare/Mac/SparkleMacWatcher.cs index 1d8c85fd..1acf2627 100644 --- a/SparkleShare/Mac/SparkleMacWatcher.cs +++ b/SparkleShare/Mac/SparkleMacWatcher.cs @@ -29,11 +29,12 @@ namespace SparkleShare { public event ChangedEventHandler Changed; private DirectoryInfo last_changed; + private Thread thread; public SparkleMacWatcher (string path) { - Thread thread = new Thread (new ThreadStart (delegate { + this.thread = new Thread (new ThreadStart (delegate { DateTime timestamp; DirectoryInfo parent = new DirectoryInfo (path); this.last_changed = new DirectoryInfo (path); @@ -49,11 +50,11 @@ namespace SparkleShare { Changed (relative_path); } - Thread.Sleep (5000); + Thread.Sleep (2500); } })); - thread.Start (); + this.thread.Start (); } @@ -74,5 +75,12 @@ namespace SparkleShare { } catch (Exception) { } } + + + public void Dispose () + { + this.thread.Join (); + this.thread.Abort (); + } } }