controller: lock when writing avatars. Fixes #476
This commit is contained in:
parent
20c6ac32d0
commit
3f70f08084
|
@ -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 ();
|
||||
}
|
||||
|
|
|
@ -85,6 +85,8 @@ namespace SparkleShare {
|
|||
private SparkleFetcherBase fetcher;
|
||||
private List<string> failed_avatars = new List<string> ();
|
||||
|
||||
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;
|
||||
|
||||
lock (this.avatar_lock)
|
||||
File.WriteAllBytes (avatar_file_path, buffer);
|
||||
|
||||
SparkleHelpers.DebugInfo ("Controller", "Fetched gravatar for " + email);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue