From 273b8cd23a80e5007afd588beaedf3a62b54fdd3 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Thu, 1 Feb 2024 16:19:56 +0900 Subject: [PATCH] Make signal input objects as weakhandle, instead of create new Since NUI don't handle memory disposeness during callback invoke, we sould send event with weak handle item. It is kind of memory leak issue. Change-Id: Ic874ab0f6c073162971e435736066e8cfff4e01f Signed-off-by: Eunki, Hong --- dali-csharp-binder/common/dali-wrap.cpp | 40 +++++++++++++++++----- .../common/view-wrapper-impl-wrap.cpp | 14 +++----- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/dali-csharp-binder/common/dali-wrap.cpp b/dali-csharp-binder/common/dali-wrap.cpp index b912bf4..85040d5 100644 --- a/dali-csharp-binder/common/dali-wrap.cpp +++ b/dali-csharp-binder/common/dali-wrap.cpp @@ -1374,15 +1374,13 @@ void SwigDirector_ViewImpl::OnChildRemove(Dali::Actor &child) { void SwigDirector_ViewImpl::OnPropertySet(Dali::Property::Index index, const Dali::Property::Value& propertyValue) { int jindex ; - void * jpropertyValue ; if (!swig_callbackOnPropertySet) { Dali::Toolkit::Internal::Control::OnPropertySet(index,propertyValue); return; } else { jindex = index; - jpropertyValue = (void *)new Dali::Property::Value((const Dali::Property::Value &)propertyValue); - swig_callbackOnPropertySet(jindex, jpropertyValue); + swig_callbackOnPropertySet(jindex, (Dali::Property::Value*)&propertyValue); } } @@ -1574,16 +1572,14 @@ void SwigDirector_ViewImpl::OnInitialize() { } void SwigDirector_ViewImpl::OnStyleChange(Dali::Toolkit::StyleManager styleManager, Dali::StyleChange::Type change) { - void * jstyleManager ; int jchange ; if (!swig_callbackOnStyleChange) { Dali::Toolkit::Internal::Control::OnStyleChange(styleManager,change); return; } else { - jstyleManager = (void *)new Dali::Toolkit::StyleManager((const Dali::Toolkit::StyleManager &)styleManager); jchange = (int)change; - swig_callbackOnStyleChange(jstyleManager, jchange); + swig_callbackOnStyleChange((Dali::Toolkit::StyleManager*)&styleManager, jchange); } } @@ -1603,13 +1599,11 @@ bool SwigDirector_ViewImpl::OnAccessibilityActivated() { bool SwigDirector_ViewImpl::OnAccessibilityPan(Dali::PanGesture gesture) { bool c_result = SwigValueInit< bool >() ; unsigned int jresult = 0 ; - void * jgesture ; if (!swig_callbackOnAccessibilityPan) { return Dali::Toolkit::Internal::Control::OnAccessibilityPan(gesture); } else { - jgesture = (void *)new Dali::PanGesture((const Dali::PanGesture &)gesture); - jresult = (unsigned int) swig_callbackOnAccessibilityPan(jgesture); + jresult = (unsigned int) swig_callbackOnAccessibilityPan((Dali::PanGesture*)&gesture); c_result = jresult ? true : false; } return c_result; @@ -27566,6 +27560,34 @@ SWIGEXPORT void SWIGSTDCALL CSharp_Dali_ViewImpl_OnPropertySet(void * jarg1, int } +SWIGEXPORT void SWIGSTDCALL CSharp_Dali_ViewImpl_OnPropertySetSwigExplicitViewImpl(void * jarg1, int jarg2, void * jarg3) { + Dali::Toolkit::Internal::Control *arg1 = (Dali::Toolkit::Internal::Control *) 0 ; + Dali::Property::Index arg2 ; + Dali::Property::Value arg3 ; + Dali::Property::Value *argp3 ; + SwigDirector_ViewImpl *darg = 0; + + arg1 = (Dali::Toolkit::Internal::Control *)jarg1; + arg2 = (Dali::Property::Index)jarg2; + argp3 = (Dali::Property::Value *)jarg3; + if (!argp3) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Property::Value", 0); + return ; + } + arg3 = *argp3; + darg = dynamic_cast(arg1); + if (!darg) { + SWIG_CSharpException(SWIG_TypeError, "dynamic_cast error. darg is null"); + return; + } + { + try { + (darg)->OnPropertySetSwigPublic(arg2,arg3); + } CALL_CATCH_EXCEPTION(); + } + +} + SWIGEXPORT void SWIGSTDCALL CSharp_Dali_ViewImpl_OnSizeSet(void * jarg1, void * jarg2) { Dali::Toolkit::Internal::Control *arg1 = (Dali::Toolkit::Internal::Control *) 0 ; diff --git a/dali-csharp-binder/common/view-wrapper-impl-wrap.cpp b/dali-csharp-binder/common/view-wrapper-impl-wrap.cpp index 89a17f3..77899df 100755 --- a/dali-csharp-binder/common/view-wrapper-impl-wrap.cpp +++ b/dali-csharp-binder/common/view-wrapper-impl-wrap.cpp @@ -79,13 +79,11 @@ void SwigDirector_ViewWrapperImpl::OnChildRemove(Dali::Actor &child) { void SwigDirector_ViewWrapperImpl::OnPropertySet(Dali::Property::Index index, const Dali::Property::Value& propertyValue) { int jindex ; - void * jpropertyValue ; jindex = index; - jpropertyValue = (void *)new Dali::Property::Value((const Dali::Property::Value &)propertyValue); if(swig_callbackOnPropertySet) { - swig_callbackOnPropertySet(jindex, jpropertyValue); + swig_callbackOnPropertySet(jindex, (Dali::Property::Value*)&propertyValue); } Dali::Toolkit::Internal::ControlWrapper::OnPropertySet(index,propertyValue); @@ -103,7 +101,7 @@ void SwigDirector_ViewWrapperImpl::OnSizeSet(Dali::Vector3 const &targetSize) { void SwigDirector_ViewWrapperImpl::OnSizeAnimation(Dali::Animation &animation, Dali::Vector3 const &targetSize) { if(swig_callbackOnSizeAnimation) { - swig_callbackOnSizeAnimation(new Dali::Animation(animation), (Dali::Vector3 *) &targetSize); + swig_callbackOnSizeAnimation((Dali::Animation*)&animation, (Dali::Vector3 *) &targetSize); } Dali::Toolkit::Internal::Control::OnSizeAnimation(animation,targetSize); @@ -272,14 +270,12 @@ void SwigDirector_ViewWrapperImpl::OnInitialize() { } void SwigDirector_ViewWrapperImpl::OnStyleChange(Dali::Toolkit::StyleManager styleManager, Dali::StyleChange::Type change) { - void * jstyleManager ; int jchange ; - jstyleManager = (void *)new Dali::Toolkit::StyleManager((const Dali::Toolkit::StyleManager &)styleManager); jchange = (int)change; if(swig_callbackOnStyleChange) { - swig_callbackOnStyleChange(jstyleManager, jchange); + swig_callbackOnStyleChange((Dali::Toolkit::StyleManager*)&styleManager, jchange); } Dali::Toolkit::Internal::Control::OnStyleChange(styleManager,change); @@ -301,13 +297,11 @@ bool SwigDirector_ViewWrapperImpl::OnAccessibilityActivated() { bool SwigDirector_ViewWrapperImpl::OnAccessibilityPan(Dali::PanGesture gesture) { bool c_result = SwigValueInit< bool >() ; unsigned int jresult = 0 ; - void * jgesture ; if (!swig_callbackOnAccessibilityPan) { return Dali::Toolkit::Internal::Control::OnAccessibilityPan(gesture); } else { - jgesture = (void *)new Dali::PanGesture((const Dali::PanGesture &)gesture); - jresult = (unsigned int) swig_callbackOnAccessibilityPan(jgesture); + jresult = (unsigned int) swig_callbackOnAccessibilityPan((Dali::PanGesture*)&gesture); c_result = jresult ? true : false; } return c_result; -- 2.7.4