fix potential crash at shutdown
This commit is contained in:
parent
0e2c26eebc
commit
4d7eb48ed7
|
@ -223,8 +223,11 @@ namespace SparkleLib {
|
|||
public void Dispose ()
|
||||
{
|
||||
this.remote_timer.Dispose ();
|
||||
this.remote_timer = null;
|
||||
this.local_timer.Dispose ();
|
||||
this.local_timer = null;
|
||||
this.listener.Dispose ();
|
||||
this.listener = null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -399,6 +402,7 @@ namespace SparkleLib {
|
|||
SparkleHelpers.DebugInfo ("Event", "[" + Name + "] " + wct.ToString () + " '" + args.Name + "'");
|
||||
SparkleHelpers.DebugInfo ("Event", "[" + Name + "] Changes found, checking if settled.");
|
||||
|
||||
if (this.remote_timer != null)
|
||||
this.remote_timer.Stop ();
|
||||
|
||||
lock (this.change_lock) {
|
||||
|
@ -448,6 +452,7 @@ namespace SparkleLib {
|
|||
{
|
||||
try {
|
||||
DisableWatching ();
|
||||
if (this.remote_timer != null)
|
||||
this.remote_timer.Stop ();
|
||||
|
||||
SparkleHelpers.DebugInfo ("SyncUp", "[" + Name + "] Initiated");
|
||||
|
@ -463,6 +468,7 @@ namespace SparkleLib {
|
|||
if (SyncStatusChanged != null)
|
||||
SyncStatusChanged (SyncStatus.Idle);
|
||||
|
||||
if (this.listener != null)
|
||||
this.listener.AnnounceBase (new SparkleAnnouncement(Identifier, CurrentRevision));
|
||||
|
||||
} else {
|
||||
|
@ -477,6 +483,7 @@ namespace SparkleLib {
|
|||
if (SyncStatusChanged != null)
|
||||
SyncStatusChanged (SyncStatus.Idle);
|
||||
|
||||
if (this.listener != null)
|
||||
this.listener.AnnounceBase (new SparkleAnnouncement (Identifier, CurrentRevision));
|
||||
|
||||
} else {
|
||||
|
@ -486,6 +493,7 @@ namespace SparkleLib {
|
|||
}
|
||||
|
||||
} finally {
|
||||
if (this.remote_timer != null)
|
||||
this.remote_timer.Start ();
|
||||
EnableWatching ();
|
||||
}
|
||||
|
@ -495,6 +503,7 @@ namespace SparkleLib {
|
|||
private void SyncDownBase ()
|
||||
{
|
||||
SparkleHelpers.DebugInfo ("SyncDown", "[" + Name + "] Initiated");
|
||||
if (this.remote_timer != null)
|
||||
this.remote_timer.Stop ();
|
||||
DisableWatching ();
|
||||
|
||||
|
@ -551,6 +560,7 @@ namespace SparkleLib {
|
|||
if (SyncStatusChanged != null)
|
||||
SyncStatusChanged (SyncStatus.Idle);
|
||||
|
||||
if (this.remote_timer != null)
|
||||
this.remote_timer.Start ();
|
||||
EnableWatching ();
|
||||
}
|
||||
|
@ -560,6 +570,7 @@ namespace SparkleLib {
|
|||
{
|
||||
lock (watch_lock) {
|
||||
this.watcher.EnableRaisingEvents = false;
|
||||
if (this.local_timer != null)
|
||||
this.local_timer.Stop ();
|
||||
}
|
||||
}
|
||||
|
@ -569,6 +580,7 @@ namespace SparkleLib {
|
|||
{
|
||||
lock (watch_lock) {
|
||||
this.watcher.EnableRaisingEvents = true;
|
||||
if (this.local_timer != null)
|
||||
this.local_timer.Start ();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue