@@ -702,7 +702,7 @@ namespace winrt::DrawingIslandComponents::implementation
702
702
{
703
703
// TODO - what is the purpose of this?
704
704
UNREFERENCED_PARAMETER (point);
705
- // VisualElement* selectedVisual = HitTestVisual(point);
705
+ // auto selectedVisual = HitTestVisual(point);
706
706
}
707
707
708
708
void
@@ -781,17 +781,22 @@ namespace winrt::DrawingIslandComponents::implementation
781
781
DeviceLostHelper const * /* sender */ ,
782
782
DeviceLostEventArgs const & /* args */ )
783
783
{
784
- // Recreate the text renderer's D3D and D2D devices.
785
- m_output.TextRenderer ->RecreateDirect2DDevice ();
784
+ // This call comes in on a Threadpool worker thread, so use the DispatcherQueue
785
+ // to marshal the call to the UI thread.
786
+ m_island.DispatcherQueue ().TryEnqueue (
787
+ [this ] {
788
+ // Recreate the text renderer's D3D and D2D devices.
789
+ m_output.TextRenderer ->RecreateDirect2DDevice ();
786
790
787
- // Give each item an opportunity to recreate its device-dependent resources.
788
- for (auto & item : m_items.Items )
789
- {
790
- item->OnDeviceLost ();
791
- }
791
+ // Give each item an opportunity to recreate its device-dependent resources.
792
+ for (auto & item : m_items.Items )
793
+ {
794
+ item->OnDeviceLost ();
795
+ }
792
796
793
- // Listen for device lost on the new device.
794
- m_output.DeviceLostHelper .WatchDevice (m_output.TextRenderer ->GetDevice ());
797
+ // Listen for device lost on the new device.
798
+ m_output.DeviceLostHelper .WatchDevice (m_output.TextRenderer ->GetDevice ());
799
+ });
795
800
}
796
801
797
802
0 commit comments