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