close
Skip to content

Track the cursor dirty flag in the correct buffer#20095

Merged
DHowett merged 1 commit into
mainfrom
dev/duhowett/📅
Apr 8, 2026

Hidden character warning

The head ref may contain hidden characters: "dev/duhowett/\ud83d\udcc5"
Merged

Track the cursor dirty flag in the correct buffer#20095
DHowett merged 1 commit into
mainfrom
dev/duhowett/📅

Conversation

@DHowett
Copy link
Copy Markdown
Member

@DHowett DHowett commented Apr 8, 2026

Failure to do so will result in every console API requiring a cursor update stalling for 500ms because we sent the update to the wrong buffer.

Closes #20092

Failure to do so will result in every console API requiring a cursor
update stalling for 500ms because we sent the update to the wrong
buffer.

Fixes #20092
Copy link
Copy Markdown
Member

@lhecker lhecker left a comment

Choose a reason for hiding this comment

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

It would be neat if this PR could also address the CUP leak we found. 🫣

@DHowett
Copy link
Copy Markdown
Member Author

DHowett commented Apr 8, 2026

It would be neat if this PR could also address the CUP leak we found. 🫣

I'd rather fix that on its own. I'm also going to change the names of all these functions so it is crystal clear what they do.

@Hona
Copy link
Copy Markdown

Hona commented Apr 8, 2026

Could this crash if activeBuffer is the alt buffer and another thread switches back to the main buffer while WaitForConptyCursorPositionToBeSynchronized() is waiting, since the alt buffer can be deleted in that window?

@DHowett
Copy link
Copy Markdown
Member Author

DHowett commented Apr 8, 2026

Nope. The console I/O handler is single-threaded, and the only way to get out of the alt buffer is by processing DECRST 1049 via WriteConsole; during the wait, the I/O sorter is servicing GetConsoleScreenBufferInfo.

@DHowett DHowett enabled auto-merge (squash) April 8, 2026 21:45
@DHowett DHowett merged commit 031998b into main Apr 8, 2026
20 checks passed
@DHowett DHowett deleted the dev/duhowett/📅 branch April 8, 2026 22:08
@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.25 Servicing Pipeline Apr 16, 2026
DHowett added a commit that referenced this pull request Apr 17, 2026
Failure to do so will result in every console API requiring a cursor
update stalling for 500ms because we sent the update to the wrong
buffer.

Closes #20092

(cherry picked from commit 031998b)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgpcJzw
Service-Version: 1.25
@DHowett DHowett moved this from To Cherry Pick to Rejected in 1.24 Servicing Pipeline Apr 30, 2026
Qmoony pushed a commit to Qmoony/terminal that referenced this pull request May 11, 2026
Failure to do so will result in every console API requiring a cursor
update stalling for 500ms because we sent the update to the wrong
buffer.

Closes microsoft#20092
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Rejected
Status: Cherry Picked

Development

Successfully merging this pull request may close these issues.

XTVERSION before alt-screen causes multi-second stalls

3 participants