Skip to content

Crash: _terminal (and other members?) used after freed in TermControl #4613

Closed

Description

@beviu

Environment

Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd]
Windows Terminal version (if applicable): master (672010a1)

Any other software?

Steps to reproduce

  1. Open the terminal
  2. Put your mouse cursor on the + button to open a new tab
  3. Quickly click with the left mouse button and then click with the middle mouse button to open a tab and close it. If you do it right, you should get this error message (which might be a bug in and of itself?): image
  4. Don't click OK yet!
  5. Focus the terminal window, behind that error message.
  6. Repeat 3. Nothing will happen because the application is frozen while you click OK in the dialog.
  7. Click OK in the dialog.
  8. Now, the dialog closes and another dialog with the same error message opens. If it didn't open, you need to start again from 2. You'll need to train to click with the right timing.
  9. Click OK in the new dialog.
  10. Terminal crashes!

Expected behavior

No crash.

Actual behavior

Crash on this line:

_terminal->LockConsole();
because even though we check that this is still alive with weakThis, _terminal is null. Also, it seems that there are other places where we do check this but don't check members that could be null now because Close was called. It's scary!

Activity

  1. ghost added
    Needs-Triage
    on Feb 16, 2020
  2. ghost added
    Needs-Tag-Fix
    on Feb 16, 2020
  3. added
    Area-UserInterface
    Severity-Crash
    Help Wanted
    Area-TerminalControl
    and removed
    Area-UserInterface
    on Feb 21, 2020
  4. DHowett-MSFT commented on Feb 21, 2020

    @DHowett-MSFT
    Contributor

    Triaged this one into v1.0 - it's stability and reliability, sp p1

  5. DHowett-MSFT commented on Feb 21, 2020

    @DHowett-MSFT
    Contributor

    The "c0000142" error is actually because powershell was started and its parent console object died before it had a chance. That one we just can't help here 😄

  6. added
    Priority-1
    and removed
    Needs-Triage
    on Feb 21, 2020
  7. added
    Issue-Bug
    on Feb 21, 2020
  8. ghost removed
    Needs-Tag-Fix
    on Feb 21, 2020
  9. zadjii-msft commented on Mar 6, 2020

    @zadjii-msft
    Member

    Okay I tried to to this naively and bluescreened my laptop. I'm not touching this, but Dustin L. Howett (MSFT) (@DHowett-MSFT) has an idea of how to go about this, so I'm going to let him have it

  10. added a commit that references this issue on Mar 20, 2020
    068f5fa
  11. ghost added
    In-PR
    on Mar 20, 2020
  12. ghost added
    Needs-Tag-Fix
    on Mar 26, 2020
  13. added a commit that references this issue on Mar 26, 2020
    5bcf0fc
  14. ghost removed
    Help Wanted
    on Mar 26, 2020
  15. ghost removed
    In-PR
    on Mar 26, 2020
  16. ghost added
    Resolution-Fix-Committed
    on Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area-TerminalControlIssue-BugNeeds-Tag-FixPriority-1Product-TerminalResolution-Fix-CommittedSeverity-Crash

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions