maui icon indicating copy to clipboard operation
maui copied to clipboard

[controls] fix memory leak in `VisualElement.Clip`

Open jonathanpeppers opened this issue 3 years ago • 1 comments

This is very much related to 58a42e5. If you:

  1. Define a <RectangleGeometry /> as a StaticResource at the application-level.

  2. Use the StaticResource on VisualElement.Clip.

  3. The VisualElement will live forever.

I could reproduce this in a unit test.

I used the same technique in 58a42e5, except for one small change. The "proxy" member fields are now allowed to be null, so these small objects should only be created on-demand now. I added appropriate null checks for this as well.

jonathanpeppers avatar Mar 09 '23 22:03 jonathanpeppers

I think the same Android API 30 keyboard-related tests are failing on main:

https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=7446466&view=ms.vss-test-web.build-test-results-tab

jonathanpeppers avatar Mar 10 '23 04:03 jonathanpeppers