Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove circular reference from ShapeDrawable #19347

Merged
merged 6 commits into from Dec 13, 2023
Merged

Conversation

PureWeen
Copy link
Member

@PureWeen PureWeen commented Dec 11, 2023

Description of Change

It looks like #18434 introduced too much weakness and the PlatformGraphicsView is keeping a reference to the created DirectRenderer because the only root for this is inside PlatformGraphicsView. This PR proposes an alternate fix that makes the IShapesView inside ShapesDrawable weak. It feels like the ShapeDrawable is causing a bunch of cycles because it's retaining a reference to the view that uses it.

Issues Fixed

Fixes #19309

@PureWeen PureWeen marked this pull request as ready for review December 11, 2023 22:33
@PureWeen PureWeen requested a review from a team as a code owner December 11, 2023 22:33
@PureWeen PureWeen requested review from mattleibow, jsuarezruiz, pictos, jonathanpeppers and Redth and removed request for pictos December 11, 2023 22:33
private WeakReference<IGraphicsRenderer> _renderer;
private IGraphicsRenderer _renderer;
Copy link
Member

Choose a reason for hiding this comment

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

This might still be an issue because PlatformGraphicsView references IGraphicsRenderer which has a reference back to PlatformGraphicsView via the DirectRenderer.GraphicsView property. Setting PlatformGraphicsView.Renderer sets the DirectRenderer.GraphicsView property to the same view, thus a circular reference in all cases.

Copy link
Member Author

Choose a reason for hiding this comment

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

#19347 (comment)
I ran the leak tests locally and they all passed.

Comment on lines -11 to +13
private WeakReference<IGraphicsRenderer> _renderer;
private IGraphicsRenderer _renderer;
private CGColorSpace _colorSpace;
private WeakReference<IDrawable> _drawable;
private IDrawable _drawable;
Copy link
Member

Choose a reason for hiding this comment

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

If this test case still passes, this is probably good 👍 :

[InlineData(typeof(BoxView))]

There may also be other cases that depend on PlatformGraphicsView: Polygon? Polyline?

Copy link
Member Author

Choose a reason for hiding this comment

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

yea I ran the whole set of "leak" tests locally and they all passed

@PureWeen PureWeen changed the base branch from main to release/8.0.1xx-sr1 December 11, 2023 23:34
@PureWeen
Copy link
Member Author

/azp run

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@jonathanpeppers
Copy link
Member

Is something AzDO down? I was just trying to review what tests passed and see:

image

Maybe we can try rerunning in the morning.

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@jonathanpeppers
Copy link
Member

/azp run

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

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

Looking at iOS device test results here:

The BoxView and all memory-related tests passed:

image

@PureWeen PureWeen enabled auto-merge (squash) December 12, 2023 18:20
- remove date picker allocation test
@@ -9,7 +9,9 @@ public class MemoryTestTypes : IEnumerable<object[]>
{
public IEnumerator<object[]> GetEnumerator()
{
#if !ANDROID
yield return new object[] { (typeof(DatePickerStub), typeof(DatePickerHandler)) };
Copy link
Member Author

Choose a reason for hiding this comment

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

We have more exhaustive tests that validate this inside controls. This test is currently redundant, and the failure currently only happens occasionally in CI. The failure is most likely due to how the test is written and not an actual bug in the bug.

PureWeen and others added 4 commits December 13, 2023 05:09
…19257)

* Use Start-Process to run build.ps1

* Show Start-Process command

* Fix: Comma separator prior to -Script argument

* Dedicated .cake parameter setting for -Script

* Fix: Start-Process: Start 3rd parameter with a quote and not an escaped quote

* Execute build.ps1 under pwsh in bash

* Remove references to Start-Process since that solution did not work

* Execute build.ps1 from bash on Mac only
@PureWeen PureWeen merged commit 2ff9fd1 into release/8.0.1xx-sr1 Dec 13, 2023
6 checks passed
@PureWeen PureWeen deleted the fix_boxview branch December 13, 2023 17:31
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[regression/8.0.0-nightly] Nightly build 9725 broke boxviews do not get their color set anymore
7 participants