summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/Renderers/CarouselPageRenderer.cs
diff options
context:
space:
mode:
authorSeungkeun Lee <sngn.lee@samsung.com>2017-06-29 13:07:21 +0900
committerKangho Hur <kangho.hur@samsung.com>2017-10-23 13:34:37 +0900
commite26fd78c87c92e68abc6ca842290c4d11002a7b6 (patch)
tree5fd59f5215af35a3e4ff1dbef01c608cbdc34584 /Xamarin.Forms.Platform.Tizen/Renderers/CarouselPageRenderer.cs
parent95b7bd0521c2c0a01f2efe77a18a7782db9bd008 (diff)
downloadxamarin-forms-e26fd78c87c92e68abc6ca842290c4d11002a7b6.tar.gz
xamarin-forms-e26fd78c87c92e68abc6ca842290c4d11002a7b6.tar.bz2
xamarin-forms-e26fd78c87c92e68abc6ca842290c4d11002a7b6.zip
Refactoring Renderers
- Apply Dispose pattern - Handle IBatchable interface on VisualElementRenderer - Make pair Event subscribe/unsubscribe Change-Id: I65018652132494722d52b1d62798f1cf1f6fc6fd
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Renderers/CarouselPageRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/CarouselPageRenderer.cs21
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);