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

[ios/catalyst] fix more cycles in NavigationPage #23164

Merged
merged 3 commits into from
Jun 21, 2024

Commits on Jun 20, 2024

  1. [ios/catalyst] fix more cycles in NavigationPage

    Fixes: dotnet#21453
    Context: dotnet#22810
    
    In dotnet#22810, a leak in `NavigationPage` was fixed for the case:
    
        Application.Current.MainPage = new NavigationPage(new Page1());
        Application.Current.MainPage = new Page2();
    
    However, it does *not* work for the case:
    
        await Navigation.PushModalAsync(new NavigationPage(new Page1()));
        await Navigation.PopModalAsync();
    
    I could reproduce this problem in `MemoryTests.cs`.
    
    There were still a few cycles in `NavigationRenderer`:
    
    * `NavigationRenderer` -> `VisualElement _element` -> `NavigationRenderer`
    
    * `NavigationRenderer` -> `Page Current` -> `NavigationRenderer`
    
    * `NavigationRenderer` -> `ViewHandlerDelegator<NavigationPage> _viewHandlerWrapper` ->  `TElement _element` -> `NavigationRenderer`
    
    After fixing these cycles, the test passes.
    
    `ViewHandlerDelegator` was slightly tricky, as I had to make a
    `_tempElement` variable and *unset* it immediately after use.
    jonathanpeppers committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    cb3ecfd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0321a35 View commit details
    Browse the repository at this point in the history
  3. Missed a null check

    jonathanpeppers committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    b91628a View commit details
    Browse the repository at this point in the history