[NUI][API12] Fix crash when we use NUI.Layout if IsUsingXaml = false
authorEunki Hong <eunkiki.hong@samsung.com>
Sat, 7 Jun 2025 15:15:47 +0000 (00:15 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Sun, 8 Jun 2025 02:04:21 +0000 (11:04 +0900)
Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/View.cs

index 422bf00d9ba609d489b201e20096ee0ebdc73831..47812ac2a2f33b8efecfe669961dbf400f3442ce 100755 (executable)
@@ -5186,8 +5186,16 @@ namespace Tizen.NUI.BaseComponents
                     else
                     {
                         // Layout not being replaced so restore margin and padding to View.
-                        SetValue(MarginProperty, layout.Margin);
-                        SetValue(PaddingProperty, layout.Padding);
+                        if (NUIApplication.IsUsingXaml)
+                        {
+                            SetValue(MarginProperty, layout.Margin);
+                            SetValue(PaddingProperty, layout.Padding);
+                        }
+                        else
+                        {
+                            SetInternalMarginProperty(this, null, layout.Margin);
+                            SetInternalPaddingProperty(this, null, layout.Padding);
+                        }
                         NotifyPropertyChanged();
                     }
                 }
@@ -5207,7 +5215,15 @@ namespace Tizen.NUI.BaseComponents
                         {
                             // If View already has a margin set then store it in Layout instead.
                             value.Margin = margin;
-                            SetValue(MarginProperty, new Extents(0, 0, 0, 0));
+                            using var temp = new Extents(0, 0, 0, 0);
+                            if (NUIApplication.IsUsingXaml)
+                            {
+                                SetValue(MarginProperty, temp);
+                            }
+                            else
+                            {
+                                SetInternalMarginProperty(this, null, temp);
+                            }
                             setMargin = true;
                         }
 
@@ -5221,7 +5237,15 @@ namespace Tizen.NUI.BaseComponents
                         {
                             // If View already has a padding set then store it in Layout instead.
                             value.Padding = padding;
-                            SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
+                            using var temp = new Extents(0, 0, 0, 0);
+                            if (NUIApplication.IsUsingXaml)
+                            {
+                                SetValue(PaddingProperty, temp);
+                            }
+                            else
+                            {
+                                SetInternalPaddingProperty(this, null, temp);
+                            }
                             setPadding = true;
                         }