Fix potential NRE accessing current application via Page.RealParent #330

Merged
merged 2 commits into from Sep 27, 2016

Conversation

Projects
None yet
5 participants
@hartez
Member

hartez commented Aug 31, 2016

Description of Change

iOS Platform was using the current Page's RealParent property to reach the current Application instance so it could set the NavigationProxy.Inner property during ViewDidAppear. But it's possible to have a situation where ViewDidAppear occurs while the current Page property is null (when setting the MainPage property from the native iOS app), which results in a NullReferenceException. Replaced the cast of RealParent with Application.Current to avoid the NRE.

Also updates the integration between the XF and native parts of Control Gallery to use MessagingCenter (and be less fragile).

Bugs Fixed

API Changes

None

Behavioral Changes

None

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Consolidate commits as makes sense

hartez added some commits Aug 29, 2016

@rmarinho rmarinho merged commit 53e1d99 into master Sep 27, 2016

4 checks passed

Android-UITests Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle8 :: UI Tests :: OSX Test Cloud Package - Run Android 6.0.1 : Tests passed: 346, ig…
Details
OSX-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle8 :: OSX Debug : Running
Details
Windows-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle8 :: Windows Debug : Tests passed: 3437, ignored: 8
Details
iOS9-UITests Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle8 :: UI Tests :: OSX Test Cloud Package - Run iOS Unified iOS9 : Tests passed: 343,…
Details

@hartez hartez deleted the fix-bugzilla40911 branch Nov 14, 2016

@samhouts samhouts added this to the 2.3.4 milestone Jun 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment