Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Fix 9939 [iOS][UWP] Dispose method not called when adding control ins…
Browse files Browse the repository at this point in the history
…ide the NavigationPage.TitleView (#10152)

* Add call for TitleView Cleanup() method when popping for UWP

* Add TitleView  Dispose() call for iOS

Co-authored-by: Yuriy Holembyovskyy <[email protected]>

fixes #9939
  • Loading branch information
yurkinh authored Apr 3, 2020
1 parent da998ca commit e4e3939
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Xamarin.Forms.Platform.UAP/NavigationPageRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,10 @@ void SetPage(Page page, bool isAnimated, bool isPopping)
if (_currentPage != null)
{
if (isPopping)
{
_currentPage.Cleanup();
_container.TitleView?.Cleanup();
}

_container.Content = null;
_currentPage.PropertyChanged -= OnCurrentPagePropertyChanged;
Expand Down
6 changes: 6 additions & 0 deletions Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,12 @@ protected override void Dispose(bool disposing)
_tracker.CollectionChanged -= TrackerOnCollectionChanged;
_tracker = null;

if (NavigationItem.TitleView != null)
{
NavigationItem.TitleView.Dispose();
NavigationItem.TitleView = null;
}

if (NavigationItem.RightBarButtonItems != null)
{
for (var i = 0; i < NavigationItem.RightBarButtonItems.Length; i++)
Expand Down

0 comments on commit e4e3939

Please sign in to comment.