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

Fix crash on paste #1173

Merged
merged 2 commits into from
Jan 31, 2020
Merged

Fix crash on paste #1173

merged 2 commits into from
Jan 31, 2020

Conversation

rjmholt
Copy link
Contributor

@rjmholt rjmholt commented Jan 31, 2020

Fixes PowerShell/vscode-powershell#2420.

As @daxian-dbw explained, PSReadLine fires off its ReadKey call on a different thread to be asynchronous. This means the PSReadLine call can return before the ReadKey delegate has been called, leading to a condition where the finally block had set the cancellation token to null but our ReadKey delegate hadn't been run yet.

It turns out we don't need to set the cancellation token source to null; it will get reset on the next call anyway.

@TylerLeonhardt
Copy link
Member

Codacy Here is an overview of what got changed by this pull request:

Issues
======
+ Solved 1
           

See the complete overview on Codacy

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rjmholt rjmholt merged commit 38fd616 into PowerShell:master Jan 31, 2020
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

Successfully merging this pull request may close these issues.

Paste a string for the password of Get-Credential crashes PSIC
2 participants