Terminal: Crashes if zoom font size up and down rapidly with ctrl + scroll wheel

Created on 23 Apr 2020  路  2Comments  路  Source: microsoft/terminal

Environment

Win10 1909 x64

Windows Terminal version (if applicable): 0.11.1121.0

Steps to reproduce

Increase and decrease the font size rapidly in the first tab using ctrl and mouse scroll wheel

Expected behavior

Not to crash

Actual behavior

Crashes


Crashes every time when I use Ctrl and the mouse wheel to increase and decrease the font rapidly. Only happens with the first tab and regardless of what is running in there. I have crash dumps. Doesn't crash when I try and record a video of it in Snagit.

image

Area-Rendering Issue-Bug Priority-1 Product-Terminal Resolution-Fix-Committed Severity-Crash

Most helpful comment

Oh that's so on me for not locking that call. I'm pretty sure the right solution here is to have the caller get the write lock before calling TriggerFontChange. Thanks for helping debug this!

All 2 comments

It's very easy to reproduce this crash with Release build. The root cause I think is that the render thread clashes with the main thread.

When font size up or down, the main thread will call DxEngine::UpdateFont, in which the render related thing(_dwriteFontFace, for example) is effectively updated. In the meantime, the render thread is happily refreshing the content using PaintBufferLine, which also uses _dwriteFontFace and friends to construct CustomTextLayout. That gives us a race condition. For some reason _dwriteFontFace became a nullptr during the process, causing the crash.

A naive (but acutally working) fix would be adding guard-return for those DX properties to prevent any null-value access. However this is far from ideal. If we going to face these kind of race issue fearlessly, maybe explicit locking is the way to go.

Oh that's so on me for not locking that call. I'm pretty sure the right solution here is to have the caller get the write lock before calling TriggerFontChange. Thanks for helping debug this!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

miniksa picture miniksa  路  3Comments

TayYuanGeng picture TayYuanGeng  路  3Comments

waf picture waf  路  3Comments

NickITGuy picture NickITGuy  路  3Comments

wkbrd picture wkbrd  路  3Comments