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 some SVACE issues. #5614

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,13 @@ internal struct cpSpaceDebugDrawOptions
private IntPtr ToPointer()
{
IntPtr drawOptionsPtr = NativeInterop.AllocStructure<cpSpaceDebugDrawOptions>();
try
if (Marshal.SizeOf(typeof(cpSpaceDebugDrawOptions)) == 0)
{
Marshal.StructureToPtr<cpSpaceDebugDrawOptions>(this, drawOptionsPtr, false);
throw new ArgumentNullException("The size of type cpSpaceDebugDrawOptions should not be 0.");
}
catch (Exception exception)
{
Tizen.Log.Fatal("NUI", "[Error] got exception during Marshal.StructureToPtr, this should not occur, message : " + exception.Message);
}


Marshal.StructureToPtr<cpSpaceDebugDrawOptions>(this, drawOptionsPtr, false);

return drawOptionsPtr;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Tizen.NUI/src/internal/Xaml/CreateValuesVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ public void Visit(ElementNode node, INode parentNode)

Values[node] = value;
}

if (value != null && value is BindableObject)
NameScope.SetNameScope(value as BindableObject, node.Namescope);
var bindableObject = value as BindableObject;
if (bindableObject != null)
NameScope.SetNameScope(bindableObject, node.Namescope);
}

public void Visit(RootNode node, INode parentNode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,23 @@ public void BindTextureResources(List<Texture> textures)
{
unsafe
{
if (textures != null && sizeof(IntPtr) * textures.Count > 0)

if (textures != null)
{
IntPtr unmanagedPointer = Marshal.AllocHGlobal(checked(sizeof(IntPtr) * textures.Count));
IntPtr[] texturesArray = new IntPtr[textures.Count];
for (int i = 0; i < textures.Count; i++)
int intptrBytes = checked(sizeof(IntPtr) * textures.Count);
if (intptrBytes>0)
{
texturesArray[i] = HandleRef.ToIntPtr(Texture.getCPtr(textures[i]));
}
System.Runtime.InteropServices.Marshal.Copy(texturesArray, 0, unmanagedPointer, textures.Count);
IntPtr unmanagedPointer = Marshal.AllocHGlobal(intptrBytes);
IntPtr[] texturesArray = new IntPtr[textures.Count];
for (int i = 0; i < textures.Count; i++)
{
texturesArray[i] = HandleRef.ToIntPtr(Texture.getCPtr(textures[i]));
}
System.Runtime.InteropServices.Marshal.Copy(texturesArray, 0, unmanagedPointer, textures.Count);

Interop.GLView.GlViewBindTextureResources(SwigCPtr, unmanagedPointer, textures.Count);
Marshal.FreeHGlobal(unmanagedPointer);
Interop.GLView.GlViewBindTextureResources(SwigCPtr, unmanagedPointer, textures.Count);
Marshal.FreeHGlobal(unmanagedPointer);
}
}
}
}
Expand Down
Loading