Skip to content

Conversation

niklasb-ms
Copy link
Contributor

Description

This change fixes a thread safety issue with DrawingIsland::OnDirect3DDeviceLost. This method recreates the D2D device and re-renders text items after device lost. The problem is that this method is called from a threadpool thread, not the UI thread. The fix is to use DispatcherQueue to marshal the call to the UI thread.

I tested this by forcing device loss using dxcap -forceTDR and verifying that text still renders correctly. I also verified in the debugger that TextRenderer::RecreateDirect2DDevice is called from the UI thread.

Copy link
Contributor

@jeffstall jeffstall left a comment

Choose a reason for hiding this comment

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

:shipit:

@jeffstall jeffstall merged commit eddebd6 into user/jeffstall/drawingisland May 9, 2024
@jeffstall jeffstall deleted the user/niklasb/device_lost_thread branch May 9, 2024 23:35
@jeffstall
Copy link
Contributor

Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants