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 scrollbar update after terminal close #3256

Merged

Conversation

mcpiroman
Copy link
Contributor

Summary of the Pull Request

This resolves (possibly not all) crashes when quickly opening and closing a tab that stem from accessing UI elements after control has closed. This looks strange to me that xaml sill runs dispatches after closing, but this seems to happen here (but it really shouldn't right?). If so, this might also explain some other crashes.

Other investigations:

  • There is definitely some use after free going on, mostly at xaml level. It also looks like terminal is invalidated even before TermControl::Close() has a chance to run.

  • The code seems to be not completely thread safe (e.g. removing TerminalOutput event handler on ConhostConnection is not synchronized). Although this could explain some occasional crashes like Terminal closes itself #2655, I rather doubt so; if these are only some single fields then x86, being strong architecture, should handle that. However I feel like it should be worthwhile to rewrite synchronization in the Terminal, TermControl, TermConnection circle.

References

Partly solves #2248, but not #2947 (which got merged into #2248).

PR Checklist

  • Closes #xxx
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Validation Steps Performed

Open tab and instantly close it.

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

This seems like a reasonable good fix to me, thanks!

@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Second It's a PR that needs another sign-off Severity-Crash Crashes are real bad news. labels Oct 25, 2019
@ghost ghost requested review from miniksa, carlos-zamora and DHowett-MSFT November 1, 2019 15:41
Copy link
Member

@miniksa miniksa left a comment

Choose a reason for hiding this comment

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

If there isn't already an issue to try to work this out systemically by improving synchronization between all the modules, please file a follow on issue.

Otherwise, I'm happy enough for now with small targeted fixes that at least improve the ongoing experience for selfhosters. So let's get this merged.

@miniksa miniksa merged commit 8c8672c into microsoft:master Nov 1, 2019
@ghost
Copy link

ghost commented Nov 26, 2019

🎉Windows Terminal Preview v0.7.3291.0 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Second It's a PR that needs another sign-off Product-Terminal The new Windows Terminal. Severity-Crash Crashes are real bad news.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants