From: Eunki, Hong Date: Mon, 24 Oct 2022 13:08:23 +0000 (+0900) Subject: Resolve C# retrieving string output lifecycle X-Git-Tag: dali_2.1.46~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0db1f24f9a4d17cfcbd0862f29beac659bcf3e1d;p=platform%2Fcore%2Fuifw%2Fdali-csharp-binder.git Resolve C# retrieving string output lifecycle Change-Id: I95a1b865efa3c2c9171d6c5d810d953e2cd41b9a Signed-off-by: Eunki, Hong --- diff --git a/dali-csharp-binder/src/internal-visual-property-get-set-wrap.cpp b/dali-csharp-binder/src/internal-visual-property-get-set-wrap.cpp index 710d934..c35e7a2 100755 --- a/dali-csharp-binder/src/internal-visual-property-get-set-wrap.cpp +++ b/dali-csharp-binder/src/internal-visual-property-get-set-wrap.cpp @@ -186,6 +186,12 @@ extern "C" try { + // Copy inputed initialized string. + // Note : C# side inputed string reference count become reduced. + // So, If we want to keep life when we fail to get result, + // We should re-convert by SWIG_csharp_string_callback. + std::string temp = (*valString == nullptr) ? "" : *valString; + Dali::Toolkit::Internal::Control& internalControl = Dali::Toolkit::Internal::GetImplementation(*pControl); Dali::Toolkit::Visual::Base visualBase = Dali::Toolkit::DevelControl::GetVisual(internalControl, visualIndex); if(visualBase) @@ -196,13 +202,13 @@ extern "C" if(retValuePtr) { //typemap in - std::string temp = retValuePtr->Get(); - - //Typemap argout in c++ file. - //This will convert c++ string to c# string - *valString = SWIG_csharp_string_callback(temp.c_str()); + temp = retValuePtr->Get(); } } + + //Typemap argout in c++ file. + //This will convert c++ string to c# string + *valString = SWIG_csharp_string_callback(temp.c_str()); } CALL_CATCH_EXCEPTION((int)InternalPropertyReturnType::ERROR_UNKNOWN);