Skip to content

Commit 0aaaf0d

Browse files
committed
bugfix - multithread allocator span
1 parent a696c79 commit 0aaaf0d

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

src/Box2D.NET/B2ArenaAllocator.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public B2ArenaAllocator(int capacity)
2727
public B2ArenaAllocatorTyped<T> GetOrCreateFor<T>() where T : new()
2828
{
2929
var index = B2ArenaAllocatorIndexer.Index<T>();
30-
if (_allocators.Length <= index)
30+
if (_allocators.Length <= index || null == _allocators[index])
3131
{
3232
lock (_lock)
3333
{
@@ -42,13 +42,7 @@ public B2ArenaAllocator(int capacity)
4242

4343
_allocators = temp;
4444
}
45-
}
46-
}
47-
48-
if (null == _allocators[index])
49-
{
50-
lock (_lock)
51-
{
45+
5246
// new
5347
if (null == _allocators[index])
5448
{

0 commit comments

Comments
 (0)