terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Window doesn't close when it's dragged WHILE a defterm app exits

Open BlockyTheDev opened this issue 3 years ago • 7 comments
trafficstars

Windows Terminal version

1.12.10733.0

Windows build number

10.0.22000.613

Other Software

No response

Steps to reproduce

  1. Create batch-file with timeout /t 5
  2. Doubleclick batch file
  3. While timer is going down move the window until the timer ends with the mouse (It is not important, when you start moving the windows, it is important that you have it ON your mouse with a pressed key, when the timer ends)
  4. Try to close the windows with pressing a key or pressing the X-Button in the right upper corner to close it

Expected Behavior

The window should close automatically after releasing the mouse (Or with pressing a key or the X-Button)

Actual Behavior

The window is NOT closing automatically, with pressing a key or with the X-Button. image

https://user-images.githubusercontent.com/86119630/164326069-bd55d556-6c07-4f75-af06-e90b9ce69939.mp4

BlockyTheDev avatar Apr 20 '22 21:04 BlockyTheDev

That's wild. Thanks for the great bug report! I wonder why moving the window while the last tab closes prevents the app from tearing down....

zadjii-msft avatar Apr 21 '22 10:04 zadjii-msft

To work around, add a new tab and then you can close the window.

hez2010 avatar Apr 26 '22 05:04 hez2010

To work around, add a new tab and then you can close the window.

Yes I found this work around too.

BlockyTheDev avatar Apr 26 '22 11:04 BlockyTheDev

Oh god this is so much worse in 1.15. It doesn't timeout at all, it instantly exits!

echo foo
@rem set /p id=Enter ID: 
timeout /t 10
echo bar
exit 1234

image

zadjii-msft avatar Dec 05 '22 23:12 zadjii-msft

~OH oh oh I bet this has to do with focus events. That's my guess - timeout will bail on input. Like, any input? That I'm not sure about. But I bet the regression between 1.12 when this was filed, and now (1.15/16/17) is the focus event stuff, and I bet eveything is immediately getting a focus event in the input queue right off the bat.~

I'll need to go inspect timeout's source to confirm. That's my hypothesis.

Notably, this doesn't repro the same if you actually "restart" the batch script, until you press a key: image

I noticed this when I restored the Terminal from being quit, and this defterm window came back ~(presumably, without the focus event)~. This might be related to #13514

Okay, my hypothesis was wrong. Looks like timeout does filter FOCUS events out... even if it does have some other horrifying code in it.

zadjii-msft avatar Dec 06 '22 14:12 zadjii-msft

I also reproduced it a few days ago by accident.

hez2010 avatar Dec 06 '22 14:12 hez2010

I'm gonna fork my above comments into a separate bug, cause there's multiple bits here with different tiers of badness.

zadjii-msft avatar Dec 06 '22 16:12 zadjii-msft

Actually, this doesn't have anything to do with defterm at all. This repros pretty readily with sleep 3 ; exit 0 in powershell too.

zadjii-msft avatar Mar 16 '23 11:03 zadjii-msft