Additional safety check to make sure EntityCollection.saveToDisc() can't run multiple iterations simultaneously; this might have been the cause of some reports of corrupted data
This commit is contained in:
parent
f7d57efe0b
commit
63837691ce
Binary file not shown.
@ -173,8 +173,14 @@ public abstract class EntityCollection<E extends Entity>
|
||||
// DISC
|
||||
// -------------------------------------------- //
|
||||
|
||||
// we don't want to let saveToDisc() run multiple iterations simultaneously
|
||||
private boolean saveIsRunning = false;
|
||||
|
||||
public boolean saveToDisc()
|
||||
{
|
||||
if (saveIsRunning) return true;
|
||||
saveIsRunning = true;
|
||||
|
||||
Map<String, E> entitiesThatShouldBeSaved = new HashMap<String, E>();
|
||||
for (E entity : this.entities)
|
||||
{
|
||||
@ -184,6 +190,7 @@ public abstract class EntityCollection<E extends Entity>
|
||||
}
|
||||
}
|
||||
|
||||
saveIsRunning = false;
|
||||
return this.saveCore(entitiesThatShouldBeSaved);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user