Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NUI] Fix crash when a layout is set into View. #6693

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions src/Tizen.NUI/src/public/BaseComponents/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6237,8 +6237,16 @@ private LayoutItem InternalLayout
else
{
// Layout not being replaced so restore margin and padding to View.
SetValue(MarginProperty, layoutExtraData.Layout.Margin);
SetValue(PaddingProperty, layoutExtraData.Layout.Padding);
if (NUIApplication.IsUsingXaml)
{
SetValue(MarginProperty, layoutExtraData.Layout.Margin);
SetValue(PaddingProperty, layoutExtraData.Layout.Padding);
}
else
{
SetInternalMargin(layoutExtraData.Layout.Margin);
SetInternalPadding(layoutExtraData.Layout.Padding);
}
NotifyPropertyChanged();
}
}
Expand All @@ -6258,7 +6266,15 @@ private LayoutItem InternalLayout
{
// 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 extents = new Extents(0, 0, 0, 0);
if (NUIApplication.IsUsingXaml)
{
SetValue(MarginProperty, extents);
}
else
{
SetInternalMargin(extents);
}
setMargin = true;
}

Expand All @@ -6272,7 +6288,15 @@ private LayoutItem InternalLayout
{
// 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 tmpPadding = new Extents(0, 0, 0, 0);
if (NUIApplication.IsUsingXaml)
{
SetValue(PaddingProperty, tmpPadding);
}
else
{
SetInternalPadding(tmpPadding);
}
setPadding = true;
}

Expand Down
Loading