summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.ControlGallery.Android
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-10-04 17:47:02 (GMT)
committerRui Marinho <me@ruimarinho.net>2016-10-04 17:47:02 (GMT)
commitd178a458ee1cdae63e1ffaf6f5445000f7b9cd0e (patch)
treeadee2c88cec80075e405220305de1a6618202c3a /Xamarin.Forms.ControlGallery.Android
parentc83c19f106162ca55ab57dfea3693246ec6155fa (diff)
downloadxamarin-forms-d178a458ee1cdae63e1ffaf6f5445000f7b9cd0e.zip
xamarin-forms-d178a458ee1cdae63e1ffaf6f5445000f7b9cd0e.tar.gz
xamarin-forms-d178a458ee1cdae63e1ffaf6f5445000f7b9cd0e.tar.bz2
Unhook drawer listeners so MDP renderer and pages can be collected (#412)
Null out page in custom MDP renderer in Control Gallery so it can be collected Checkpoint Checkpoint Checkpoint Checkpoint Checkpoint Checkpoint
Diffstat (limited to 'Xamarin.Forms.ControlGallery.Android')
-rw-r--r--Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs9
1 files changed, 9 insertions, 0 deletions
diff --git a/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs b/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
index a550212..0530fc3 100644
--- a/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
+++ b/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
@@ -34,6 +34,7 @@ namespace Xamarin.Forms.ControlGallery.Android
public class NativeDroidMasterDetail : Xamarin.Forms.Platform.Android.AppCompat.MasterDetailPageRenderer
{
MasterDetailPage _page;
+ bool _disposed;
protected override void OnElementChanged(VisualElement oldElement, VisualElement newElement)
{
@@ -61,10 +62,18 @@ namespace Xamarin.Forms.ControlGallery.Android
protected override void Dispose(bool disposing)
{
+ if (_disposed)
+ {
+ return;
+ }
+
+ _disposed = true;
+
if (disposing && _page != null)
{
_page.LayoutChanged -= Page_LayoutChanged;
_page.PropertyChanged -= Page_PropertyChanged;
+ _page = null;
}
base.Dispose(disposing);