Skip to content

DelayPromise Leaks when use SuppressCancellationThrow #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xiao-sudo opened this issue May 14, 2025 · 0 comments
Open

DelayPromise Leaks when use SuppressCancellationThrow #661

xiao-sudo opened this issue May 14, 2025 · 0 comments

Comments

@xiao-sudo
Copy link

Usage

var cancelled = await UniTask.Delay(10000, cancellationToken: m_Cts.Token).SuppressCancellationThrow();

Problem

// in IsCanceledSource
public bool GetResult(short token)
{
    if (source.GetStatus(token) == UniTaskStatus.Canceled)
    {
        return true;
    }

    source.GetResult(token);
    return false;
}

When the Task is cancelled, IsCanceledSource.GetResource return true directly,but DelayPromise.TryReturn is not called and this DelayPromise can not be recycled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant