diff --git a/Penumbra/Collections/Manager/CollectionStorage.cs b/Penumbra/Collections/Manager/CollectionStorage.cs index c26ce7f9..c20d72bb 100644 --- a/Penumbra/Collections/Manager/CollectionStorage.cs +++ b/Penumbra/Collections/Manager/CollectionStorage.cs @@ -89,8 +89,12 @@ public class CollectionStorage : IReadOnlyList, IDisposable, ISer /// Starts at 1 because the empty collection gets Zero. public LocalCollectionId CurrentCollectionId => new(_currentCollectionIdValue); - private LocalCollectionId AllocateNextId () - => new(Interlocked.Increment(ref _currentCollectionIdValue)); + private LocalCollectionId AllocateNextId () + { + var newLocalId = new LocalCollectionId(_currentCollectionIdValue); + Interlocked.Increment(ref _currentCollectionIdValue); + return newLocalId; + } /// Default enumeration skips the empty collection. public IEnumerator GetEnumerator()