Skip to content

Commit

Permalink
Removed redundant retain.
Browse files Browse the repository at this point in the history
  • Loading branch information
timcassell committed Sep 10, 2023
1 parent c224cec commit 0e55853
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions Package/Core/Promises/Internal/MergeInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,13 @@ protected bool RemoveWaiterAndGetIsComplete()

protected void ReleaseAndHandleNext(object rejectContainer, Promise.State state)
{
// Decrement retain counter instead of calling MaybeDispose, since we know the next handler will call MaybeDispose.
InterlockedAddWithUnsignedOverflowCheck(ref _retainCounter, -1);
HandleNextInternal(rejectContainer, state);
}

protected void Setup(ValueLinkedStack<PromisePassThrough> promisePassThroughs, int pendingAwaits, ushort depth)
{
_waitCount = pendingAwaits;
unchecked
{
_retainCounter = pendingAwaits + 1;
}
_retainCounter = pendingAwaits;
Reset(depth);

_passThroughs = promisePassThroughs;
Expand Down
2 changes: 1 addition & 1 deletion Package/Core/Promises/Internal/PromiseFieldsInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ partial class CancelablePromiseCancelPromise<TResult, TCanceler> : PromiseWaitPr
#region Multi Promises
partial class MultiHandleablePromiseBase<TResult> : PromiseSingleAwait<TResult>
{
volatile protected int _waitCount;
protected int _waitCount;
protected int _retainCounter;
// We store the passthroughs for lazy progress subscribe.
// The passthroughs will be released when this has fully released if a progress listener did not do it already.
Expand Down

0 comments on commit 0e55853

Please sign in to comment.