Skip to content
3 changes: 3 additions & 0 deletions source/Handlebars/Collections/DictionarySlim.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ public void AddOrReplace(in TKey key, in TValue value)
(uint)i < (uint)entries.Length; i = entries[i].Next)
{
if (_comparer.Equals(key, entries[i].Key))
{
entries[i].Value = value;
return;
}
Comment thread
rexm marked this conversation as resolved.
if (collisionCount == entries.Length)
{
// The chain of entries forms a loop; which means a concurrent update has happened.
Expand Down
2 changes: 2 additions & 0 deletions source/Handlebars/Collections/WeakCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class WeakCollection<T> : IEnumerable<T> where T : class

public void Add(T value)
{
// Need a way to reset _firstAvailableIndex periodically

for (var index = _firstAvailableIndex; index < _store.Count; index++)
Comment thread
rexm marked this conversation as resolved.
{
if (_store[index] == null)
Expand Down
2 changes: 2 additions & 0 deletions source/Handlebars/Pools/BindingContext.Pool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ internal struct BindingContextPolicy : IInternalObjectPoolPolicy<BindingContext>

public bool Return(BindingContext item)
{
item.Configuration = null;

item.Root = null;
Comment thread
rexm marked this conversation as resolved.
item.Value = null;
item.ParentContext = null;
Expand Down
Loading