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 memory leaks in Size2D & Rectangle. #6681

Open
wants to merge 1 commit into
base: DevelNUI
Choose a base branch
from

Conversation

huayongxu
Copy link
Contributor

Description of Change

API Changes

  • ACR:

@@ -55,7 +55,7 @@ public Rectangle PositionSize
}
get
{
Rectangle ret = Rectangle.GetRectangleFromPtr(Interop.WindowData.GetPositionSize(SwigCPtr));
Rectangle ret = Rectangle.GetRectangleFromPtr(Interop.WindowData.GetPositionSize(SwigCPtr), true);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interop.WindowData..GetPositionSize is related to CSharp_Dali_WindowData_GetPositionSize at csharp-binder side:

SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_WindowData_GetPositionSize(void* nuiWindowData)
{
void* nuiResult;
Dali::WindowData* pWindowData;
Dali::Rect result;

pWindowData = (Dali::WindowData*)nuiWindowData;
if(!pWindowData)
{
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::WindowData", 0);
return nullptr;
}

{
try
{
result = pWindowData->GetPositionSize();
}
CALL_CATCH_EXCEPTION(0);
}

nuiResult = new Dali::Rect((const Dali::Rect&)result);
return nuiResult;
}

The return value is allocated by new operator, it need be deleted.

@@ -90,7 +90,7 @@ public Size2D GetSize()
{
global::System.IntPtr cPtr = Interop.Picture.GetSize(View.getCPtr(this));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interop.Picture.GetSize is related to CSharp_Dali_Picture_GetSize:

SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_Picture_GetSize(char *pPicture) {
Dali::CanvasRenderer::Picture picture;
Dali::Vector2 result;

if (!pPicture) {
SWIG_CSharpSetPendingExceptionArgument(
SWIG_CSharpArgumentNullException,
"Attempt to dereference null Dali::CanvasRenderer::Picture", 0);
return nullptr;
}
picture = *(Dali::CanvasRenderer::Picture *)pPicture;

{
try {
result = picture.GetSize();
}
CALL_CATCH_EXCEPTION(0);
}

return new Dali::Vector2((const Dali::Vector2 &)result);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant