diff options
author | adrianknight89 <adrianknight89@outlook.com> | 2017-02-09 10:03:41 -0600 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2017-02-09 16:03:41 +0000 |
commit | 56e3629c821248a3a6c547de901440055511092b (patch) | |
tree | 34179230fa2c51b290aaabb15b0ec3a954f2a028 /Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared | |
parent | faa6eae8e72d810c8d16dd92e02b305dbf35548c (diff) | |
download | xamarin-forms-56e3629c821248a3a6c547de901440055511092b.tar.gz xamarin-forms-56e3629c821248a3a6c547de901440055511092b.tar.bz2 xamarin-forms-56e3629c821248a3a6c547de901440055511092b.zip |
[iOS] Fix NavigationPage memory leak when back button title is set (#523)
* fix memory leak
* fix parent
* added comment
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared')
2 files changed, 62 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44047.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44047.cs new file mode 100644 index 00000000..a4d99357 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44047.cs @@ -0,0 +1,61 @@ +using System; +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; + +#if UITEST +using Xamarin.UITest; +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 44047, "Memory leak when using SetBackButtonTitle on iOS", PlatformAffected.iOS)] + public class Bugzilla44047 : TestMasterDetailPage + { + protected override void Init() + { + Master = new ContentPage + { + Title = "Menu" + }; + + Detail = new NavigationPage(new Page1()); + } + } + + public class Page1 : ContentPage + { + public Page1() + { + Title = "Page1"; + Content = new Button + { + Text = "Open Page2", + Command = new Command(async o => + { + await (Parent as NavigationPage).PushAsync(new Page2()); + }) + }; + } + } + + public class Page2 : ContentPage + { + public Page2() + { + GC.Collect(); + GC.WaitForPendingFinalizers(); + GC.Collect(); + + Title = "Page2"; + System.Diagnostics.Debug.WriteLine("Constructor"); + NavigationPage.SetBackButtonTitle(this, "Custom"); + } + + ~Page2() + { + System.Diagnostics.Debug.WriteLine("Finalizer"); + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index e55302a9..742c29a7 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -143,6 +143,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla43313.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla43469.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla43516.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Bugzilla44047.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla43941.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla43663.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla43867.cs" /> |