From 47b0e7c30589045ef790f709ee9e6d0fa517accd Mon Sep 17 00:00:00 2001 From: Umar Date: Mon, 25 Sep 2017 20:05:55 +0100 Subject: [PATCH] Dispose Children when Parent is being disposed. Change-Id: I1c90f2dbc822f1fde25df5aef888f41959ee9cf4 --- Tizen.NUI/src/public/BaseComponents/View.cs | 7 +++++++ Tizen.NUI/src/public/Layer.cs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/Tizen.NUI/src/public/BaseComponents/View.cs b/Tizen.NUI/src/public/BaseComponents/View.cs index ecf7b1a..3f23151 100755 --- a/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/Tizen.NUI/src/public/BaseComponents/View.cs @@ -159,6 +159,13 @@ namespace Tizen.NUI.BaseComponents } base.Dispose(type); + + // Dispose all Children of this View. + foreach (View childView in Children) + { + childView?.Dispose(); + } + Children.Clear(); } private void DisConnectFromSignals() diff --git a/Tizen.NUI/src/public/Layer.cs b/Tizen.NUI/src/public/Layer.cs index e62d647..0be286e 100755 --- a/Tizen.NUI/src/public/Layer.cs +++ b/Tizen.NUI/src/public/Layer.cs @@ -124,6 +124,13 @@ namespace Tizen.NUI } base.Dispose(type); + + // Dispose all Children of this Layer. + foreach (View childView in Children) + { + childView?.Dispose(); + } + Children.Clear(); } -- 2.7.4