Skip to content

Commit fad06a0

Browse files
committed
Call layer.setNeedsDisplay on show. (#17096)
The `AvaloniaNative.GlPlatformSurface.CreateGlRenderTarget` method can only be called on the UI thread. In normal circumstances this method is called in response to a call to `TopLevel.HandlePaint` from the native `AvnView.updateLayer` method. However, a customer was experiencing a problem where `AvnView.updateLayer` and by extension `TopLevel.HandlePaint` were being called before the window is shown. This broke the creation of the GL render target.
1 parent 89c9702 commit fad06a0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

native/Avalonia.Native/src/OSX/WindowBaseImpl.mm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@
132132

133133
_shown = true;
134134
[Window setCollectionBehavior:collectionBehavior];
135+
136+
// Ensure that we call needsDisplay = YES so that AvnView.updateLayer is called after the
137+
// window is shown: if the client is pumping messages during the window creation/show
138+
// process, it's possible that updateLayer gets called after the window is created but
139+
// before it's is shown.
140+
[View.layer setNeedsDisplay];
141+
135142
return S_OK;
136143
}
137144
}

0 commit comments

Comments
 (0)