Skip to content

Commit

Permalink
Possible fix for #80 by locking access to untracked Entities for thre…
Browse files Browse the repository at this point in the history
…ad safety
  • Loading branch information
8vogt committed Apr 4, 2021
1 parent e7b15b5 commit e08cf14
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion SEWorldGenPlugin/Generator/MyStarSystemGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using System.Collections.Generic;
using VRage.Game;
using VRage.Game.Components;
using VRage.Game.Entity;
using VRage.Library.Utils;
using VRageMath;

Expand Down
2 changes: 1 addition & 1 deletion SEWorldGenPlugin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.5.1")]
[assembly: AssemblyVersion("2.0.5.3")]
[assembly: AssemblyFileVersion("1.0.0")]
6 changes: 4 additions & 2 deletions SEWorldGenPlugin/Session/MyEntityTrackerComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ public void TrackEntity(MyEntity entity)
m_newTrackedEntities.Add(entity);
entity.OnMarkForClose += (e) =>
{
m_toUntrackEntities.Add(e);
lock(m_toUntrackEntities)
m_toUntrackEntities.Add(e);
};
}
}
Expand Down Expand Up @@ -157,7 +158,8 @@ private void OnGridPlayerPresenceUpdate(MyCubeGrid grid)
{
if(grid.PlayerPresenceTier != VRage.Game.ModAPI.MyUpdateTiersPlayerPresence.Normal)
{
m_toUntrackEntities.Add(grid);
lock(m_toUntrackEntities)
m_toUntrackEntities.Add(grid);
}
}
}
Expand Down

0 comments on commit e08cf14

Please sign in to comment.