Skip to content

Commit

Permalink
Merge pull request #31 from prozolic/pullreq
Browse files Browse the repository at this point in the history
Add lock to ObservableHashSet.TryGetValue
  • Loading branch information
neuecc authored Feb 26, 2024
2 parents 170eecf + 557adc7 commit 20a1c35
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ObservableCollections/ObservableHashSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ public void Clear()

public bool TryGetValue(T equalValue, [MaybeNullWhen(false)] out T actualValue)
{
return set.TryGetValue(equalValue, out actualValue);
lock(SyncRoot)
{
return set.TryGetValue(equalValue, out actualValue);
}
}

#endif
Expand Down

0 comments on commit 20a1c35

Please sign in to comment.