diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index 4be397e5..36d70a5c 100755 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -523,7 +523,7 @@ namespace SparkleLib { public void DisableWatching () { - lock (watch_lock) { + lock (this.watch_lock) { this.watcher.EnableRaisingEvents = false; this.local_timer.Stop (); } @@ -532,7 +532,7 @@ namespace SparkleLib { public void EnableWatching () { - lock (watch_lock) { + lock (this.watch_lock) { this.watcher.EnableRaisingEvents = true; this.local_timer.Start (); } diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 4bd64c69..9b11c37f 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -85,6 +85,8 @@ namespace SparkleShare { private SparkleFetcherBase fetcher; private List failed_avatars = new List (); + private Object avatar_lock = new Object (); + // Short alias for the translations public static string _ (string s) @@ -920,7 +922,10 @@ namespace SparkleShare { // if not empty if (buffer.Length > 255) { avatar_fetched = true; - File.WriteAllBytes (avatar_file_path, buffer); + + lock (this.avatar_lock) + File.WriteAllBytes (avatar_file_path, buffer); + SparkleHelpers.DebugInfo ("Controller", "Fetched gravatar for " + email); }