Skip to content
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

Don't dispose the CancellationTokenSource until all onCancellationRequested handlers have run #199067

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

roblourens
Copy link
Member

@roblourens roblourens commented Nov 25, 2023

Fix #199068

The CancelablePromise disposes its CancellationTokenSource inside a onCancellationRequested listener. That means that any other onCancellationRequested listeners that were added after that one won't be called, because the EventEmitter has been disposed. In practice that means that any listener that was added after an async step inside the callback function is not called.

@roblourens roblourens marked this pull request as ready for review January 3, 2024 01:35
@roblourens roblourens merged commit 0a08e6f into main Jan 3, 2024
7 checks passed
@roblourens roblourens deleted the roblou/CancelablePromise branch January 3, 2024 18:02
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not all onCancellationRequested listeners are called for a CancelablePromise
2 participants