summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2017-01-03 12:02:10 (GMT)
committerRui Marinho <me@ruimarinho.net>2017-01-03 12:02:10 (GMT)
commit58909e205a6b10fd1ed834c0ea5a37950504d035 (patch)
tree3d7d29a6b6fdb48af4792d3e0f30319a39531482 /Xamarin.Forms.Platform.iOS
parentf003cfd3886adb85cd6dd10e8083bc82abb68234 (diff)
downloadxamarin-forms-58909e205a6b10fd1ed834c0ea5a37950504d035.zip
xamarin-forms-58909e205a6b10fd1ed834c0ea5a37950504d035.tar.gz
xamarin-forms-58909e205a6b10fd1ed834c0ea5a37950504d035.tar.bz2
Allow subscriber to be collected if MessagingCenter is the only reference to it (#617)
* Repro * Make messaging center callbacks weak references * Preserve attribute * Fix test method name * Watch for collection of actual delegate target instead of wrapper delegate * Preserve the original platform instance when changing main page * Better tests for lambda situations * Update tests, make callback target a weakreference if it's the subscriber * Ensure old Platform MessagingCenter subs are gone before creating new Platform
Diffstat (limited to 'Xamarin.Forms.Platform.iOS')
-rw-r--r--Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs b/Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs
index 0aacfd0..da51718 100644
--- a/Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs
+++ b/Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs
@@ -165,9 +165,11 @@ namespace Xamarin.Forms.Platform.iOS
return;
var platformRenderer = (PlatformRenderer)_window.RootViewController;
- _window.RootViewController = _application.MainPage.CreateViewController();
+
if (platformRenderer != null)
((IDisposable)platformRenderer.Platform).Dispose();
+
+ _window.RootViewController = _application.MainPage.CreateViewController();
}
}
} \ No newline at end of file