Skip to content

Commit

Permalink
[NUI] Fix a memory leak in Vector4.
Browse files Browse the repository at this point in the history
  • Loading branch information
huayongxu authored and dongsug-song committed Feb 11, 2025
1 parent a5a2073 commit 6bad862
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public Vector4 BoundingBox
get
{
global::System.IntPtr cPtr = Interop.Drawable.GetBoundingBox(BaseHandle.getCPtr(this));
return Vector4.GetVector4FromPtr(cPtr);
return new Vector4(cPtr, true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public ReadOnlyCollection<ColorStop> ColorStops
for (uint i = 0; i < colorStopsCount; i++)
{
retList.Add(new ColorStop(Interop.Gradient.GetColorStopsOffsetIndexOf(BaseHandle.getCPtr(this), i),
Vector4.GetVector4FromPtr(Interop.Gradient.GetColorStopsColorIndexOf(BaseHandle.getCPtr(this), i))));
new Vector4(Interop.Gradient.GetColorStopsColorIndexOf(BaseHandle.getCPtr(this), i), true)));
}

return retList.AsReadOnly();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Color FillColor
get
{
global::System.IntPtr cPtr = Interop.Shape.GetFillColor(BaseHandle.getCPtr(this));
return Vector4.GetVector4FromPtr(cPtr);
return new Vector4(cPtr, true);
}
set
{
Expand Down Expand Up @@ -144,7 +144,7 @@ public Color StrokeColor
get
{
global::System.IntPtr cPtr = Interop.Shape.GetStrokeColor(BaseHandle.getCPtr(this));
return Vector4.GetVector4FromPtr(cPtr);
return new Vector4(cPtr, true);
}
set
{
Expand Down
7 changes: 0 additions & 7 deletions src/Tizen.NUI/src/public/Common/Vector4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -732,13 +732,6 @@ internal void Reset(float x, float y, float z, float w)
NDalicPINVOKE.ThrowExceptionIfExists();
}

internal static Vector4 GetVector4FromPtr(global::System.IntPtr cPtr)
{
Vector4 ret = new Vector4(cPtr, false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}

internal float Dot(Vector3 other)
{
float ret = Interop.Vector4.DotWithVector3(SwigCPtr, Vector3.getCPtr(other));
Expand Down

0 comments on commit 6bad862

Please sign in to comment.