[NUI] Fix wrong casting
authorpichulia <eunkiki.hong@samsung.com>
Fri, 5 Feb 2021 11:33:35 +0000 (20:33 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Mon, 8 Feb 2021 01:21:42 +0000 (10:21 +0900)
Layer and View class don't have any depencency.
So if we try to convert Layer to View (without "as" operator), it may create some critical issues.

Signed-off-by: pichulia <eunkiki.hong@samsung.com>
src/Tizen.NUI/src/public/Layouting/LayoutItem.cs

index cddda5e..0d60b2b 100755 (executable)
@@ -168,7 +168,10 @@ namespace Tizen.NUI
             OnAttachedToOwner();
             // Add layout to parent layout if a layout container
             View parent = Owner.GetParent() as View;
-            (parent?.Layout as LayoutGroup)?.Add( this );
+            if (parent != null)
+            {
+                (parent?.Layout as LayoutGroup)?.Add( this );
+            }
 
             // If Add or ChangeOnAdd then do not update condition
             if (ConditionForAnimation.Equals(TransitionCondition.Unspecified))
@@ -551,8 +554,7 @@ namespace Tizen.NUI
                                                          " top:" + _layoutPositionData.Top +
                                                          " right:" + _layoutPositionData.Right +
                                                          " bottom:" + _layoutPositionData.Bottom );
-                Container onwerContainer = Owner.GetParent();
-                View onwerView = onwerContainer is Layer ? new View(Layer.getCPtr(onwerContainer).Handle, false) : onwerContainer as View;
+                View onwerView = Owner.GetParent() as View;
 
                 if (onwerView != null && onwerView.Layout != null && onwerView.Layout.LayoutWithTransition)
                 {