diff options
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Renderers/CarouselPageRenderer.cs')
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Renderers/CarouselPageRenderer.cs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/CarouselPageRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/CarouselPageRenderer.cs index c89fae0c..469d1a91 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/CarouselPageRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/CarouselPageRenderer.cs @@ -87,7 +87,7 @@ namespace Xamarin.Forms.Platform.Tizen if (e.OldElement != null) { - Element.CurrentPageChanged -= OnCurrentPageChanged; + e.OldElement.CurrentPageChanged -= OnCurrentPageChanged; } if (e.NewElement != null) @@ -111,15 +111,20 @@ namespace Xamarin.Forms.Platform.Tizen /// <param name="disposing">True if the memory release was requested on demand.</param> protected override void Dispose(bool disposing) { - if (_box != null) + if (disposing) { - Element.CurrentPageChanged -= OnCurrentPageChanged; - - // Unpacks the page from the box to prevent it from being disposed of prematurely: - _box.UnPack(_page); + if (Element != null) + { + Element.CurrentPageChanged -= OnCurrentPageChanged; + } + if (_box != null) + { + // Unpacks the page from the box to prevent it from being disposed of prematurely: + _box.UnPack(_page); - _box.Unrealize(); - _box = null; + _box.Unrealize(); + _box = null; + } } base.Dispose(disposing); |