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 ()
|
public void DisableWatching ()
|
||||||
{
|
{
|
||||||
lock (watch_lock) {
|
lock (this.watch_lock) {
|
||||||
this.watcher.EnableRaisingEvents = false;
|
this.watcher.EnableRaisingEvents = false;
|
||||||
this.local_timer.Stop ();
|
this.local_timer.Stop ();
|
||||||
}
|
}
|
||||||
|
@ -532,7 +532,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public void EnableWatching ()
|
public void EnableWatching ()
|
||||||
{
|
{
|
||||||
lock (watch_lock) {
|
lock (this.watch_lock) {
|
||||||
this.watcher.EnableRaisingEvents = true;
|
this.watcher.EnableRaisingEvents = true;
|
||||||
this.local_timer.Start ();
|
this.local_timer.Start ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,8 @@ namespace SparkleShare {
|
||||||
private SparkleFetcherBase fetcher;
|
private SparkleFetcherBase fetcher;
|
||||||
private List<string> failed_avatars = new List<string> ();
|
private List<string> failed_avatars = new List<string> ();
|
||||||
|
|
||||||
|
private Object avatar_lock = new Object ();
|
||||||
|
|
||||||
|
|
||||||
// Short alias for the translations
|
// Short alias for the translations
|
||||||
public static string _ (string s)
|
public static string _ (string s)
|
||||||
|
@ -920,7 +922,10 @@ namespace SparkleShare {
|
||||||
// if not empty
|
// if not empty
|
||||||
if (buffer.Length > 255) {
|
if (buffer.Length > 255) {
|
||||||
avatar_fetched = true;
|
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);
|
SparkleHelpers.DebugInfo ("Controller", "Fetched gravatar for " + email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue