mac: dispose watcher thread on quit
This commit is contained in:
parent
4d972c66d1
commit
2b0f53e1f3
|
@ -145,5 +145,12 @@ namespace SparkleShare {
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
new public void Quit ()
|
||||||
|
{
|
||||||
|
this.watcher.Dispose ();
|
||||||
|
base.Quit ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,11 +29,12 @@ namespace SparkleShare {
|
||||||
public event ChangedEventHandler Changed;
|
public event ChangedEventHandler Changed;
|
||||||
|
|
||||||
private DirectoryInfo last_changed;
|
private DirectoryInfo last_changed;
|
||||||
|
private Thread thread;
|
||||||
|
|
||||||
|
|
||||||
public SparkleMacWatcher (string path)
|
public SparkleMacWatcher (string path)
|
||||||
{
|
{
|
||||||
Thread thread = new Thread (new ThreadStart (delegate {
|
this.thread = new Thread (new ThreadStart (delegate {
|
||||||
DateTime timestamp;
|
DateTime timestamp;
|
||||||
DirectoryInfo parent = new DirectoryInfo (path);
|
DirectoryInfo parent = new DirectoryInfo (path);
|
||||||
this.last_changed = new DirectoryInfo (path);
|
this.last_changed = new DirectoryInfo (path);
|
||||||
|
@ -49,11 +50,11 @@ namespace SparkleShare {
|
||||||
Changed (relative_path);
|
Changed (relative_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.Sleep (5000);
|
Thread.Sleep (2500);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
thread.Start ();
|
this.thread.Start ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,5 +75,12 @@ namespace SparkleShare {
|
||||||
|
|
||||||
} catch (Exception) { }
|
} catch (Exception) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Dispose ()
|
||||||
|
{
|
||||||
|
this.thread.Join ();
|
||||||
|
this.thread.Abort ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue