From 0a9a729ce93249a8d2372e4fa76612a044898269 Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Thu, 9 Sep 2021 17:15:59 -0400 Subject: [PATCH] fix(commandbar): [iOS] Don't fetch the internal TitleView parent on invalidate measure --- .../Controls/CommandBarNavigationItemRenderer.iOS.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Uno.UI/Controls/CommandBarNavigationItemRenderer.iOS.cs b/src/Uno.UI/Controls/CommandBarNavigationItemRenderer.iOS.cs index 96cb557659d0..bbb6ab9ded36 100644 --- a/src/Uno.UI/Controls/CommandBarNavigationItemRenderer.iOS.cs +++ b/src/Uno.UI/Controls/CommandBarNavigationItemRenderer.iOS.cs @@ -159,6 +159,16 @@ internal partial class TitleView : Border private Size _childSize; private Size? _lastAvailableSize; + public override void SetSuperviewNeedsLayout() + { + // Skip the base invocation because the base fetches the native parent + // view. This process creates a managed proxy during navigations, the + // native counterpart is released. This causes the managed NSObject_Disposer:Drain + // to fail to release an already released native reference. + // + // See https://github.com/unoplatform/uno/issues/7012 for more details. + } + internal TitleView() { if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))