Fix memory leak 37/311937/1
authorjoogab.yun <joogab.yun@samsung.com>
Fri, 31 May 2024 00:44:00 +0000 (09:44 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Fri, 31 May 2024 00:44:00 +0000 (09:44 +0900)
Fix memory leak which returns new Vector and the returned Vector is used
as follows in NUI.

global::System.IntPtr cPtr = func(SwigCPtr);
new Vector2(cPtr, false);

refer
https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-csharp-binder/+/311930/

Change-Id: I91b6956b32bf8eed5dc7d8f09aa24afbaa485c5c

dali-csharp-binder/common/dali-wrap.cpp
dali-csharp-binder/dali-core/gestures-wrap.cpp

index 2c8994c..d634322 100644 (file)
@@ -13830,12 +13830,12 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Dali_LongPressGesture_numberOfTouches
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_LongPressGesture_screenPoint_get(void * jarg1) {
   void * jresult ;
   Dali::LongPressGesture *arg1 = (Dali::LongPressGesture *) 0 ;
-  Dali::Vector2 result;
+  Dali::Vector2 *result;
 
   arg1 = (Dali::LongPressGesture *)jarg1;
   {
     try {
-      result = ((Dali::LongPressGesture const *)arg1)->GetScreenPoint();
+      result = (Dali::Vector2 *)&(((Dali::LongPressGesture const *)arg1)->GetScreenPoint());
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -13854,7 +13854,7 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_LongPressGesture_screenPoint_get(void
       };
     }
   }
-  jresult = new Dali::Vector2((const Dali::Vector2 &)result);
+  jresult = (void *)result;
   return jresult;
 }
 
@@ -13862,12 +13862,12 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_LongPressGesture_screenPoint_get(void
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_LongPressGesture_localPoint_get(void * jarg1) {
   void * jresult ;
   Dali::LongPressGesture *arg1 = (Dali::LongPressGesture *) 0 ;
-  Dali::Vector2 result;
+  Dali::Vector2 *result;
 
   arg1 = (Dali::LongPressGesture *)jarg1;
   {
     try {
-      result = ((Dali::LongPressGesture const *)arg1)->GetLocalPoint();
+      result = (Dali::Vector2 *)&(((Dali::LongPressGesture const *)arg1)->GetLocalPoint());
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -13886,7 +13886,7 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_LongPressGesture_localPoint_get(void *
       };
     }
   }
-  jresult = new Dali::Vector2((const Dali::Vector2 &)result);
+  jresult = (void *)result;
   return jresult;
 }
 
@@ -15521,12 +15521,12 @@ SWIGEXPORT void SWIGSTDCALL CSharp_Dali_delete_PanGesture(void * jarg1) {
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_velocity_get(void * jarg1) {
   void * jresult ;
   Dali::PanGesture *arg1 = (Dali::PanGesture *) 0 ;
-  Dali::Vector2 result;
+  Dali::Vector2 *result;
 
   arg1 = (Dali::PanGesture *)jarg1;
   {
     try {
-      result = ((Dali::PanGesture const *)arg1)->GetVelocity();
+      result = (Dali::Vector2 *)&(((Dali::PanGesture const *)arg1)->GetVelocity());
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -15545,7 +15545,7 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_velocity_get(void * jarg1)
       };
     }
   }
-  jresult = new Dali::Vector2((const Dali::Vector2 &)result);
+  jresult = (void *)result;
   return jresult;
 }
 
@@ -15553,12 +15553,12 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_velocity_get(void * jarg1)
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_displacement_get(void * jarg1) {
   void * jresult ;
   Dali::PanGesture *arg1 = (Dali::PanGesture *) 0 ;
-  Dali::Vector2 result;
+  Dali::Vector2 *result;
 
   arg1 = (Dali::PanGesture *)jarg1;
   {
     try {
-      result = ((Dali::PanGesture const *)arg1)->GetDisplacement();
+      result = (Dali::Vector2 *)&(((Dali::PanGesture const *)arg1)->GetDisplacement());
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -15577,7 +15577,7 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_displacement_get(void * jar
       };
     }
   }
-  jresult = new Dali::Vector2((const Dali::Vector2 &)result);
+  jresult = (void *)result;
   return jresult;
 }
 
@@ -15585,12 +15585,12 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_displacement_get(void * jar
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_position_get(void * jarg1) {
   void * jresult ;
   Dali::PanGesture *arg1 = (Dali::PanGesture *) 0 ;
-  Dali::Vector2 result;
+  Dali::Vector2 *result;
 
   arg1 = (Dali::PanGesture *)jarg1;
   {
     try {
-      result = ((Dali::PanGesture const *)arg1)->GetPosition();
+      result = (Dali::Vector2 *)&(((Dali::PanGesture const *)arg1)->GetPosition());
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -15609,19 +15609,19 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_position_get(void * jarg1)
       };
     }
   }
-  jresult = new Dali::Vector2((const Dali::Vector2 &)result);
+  jresult = (void *)result;
   return jresult;
 }
 
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_screenVelocity_get(void * jarg1) {
   void * jresult ;
   Dali::PanGesture *arg1 = (Dali::PanGesture *) 0 ;
-  Dali::Vector2 result;
+  Dali::Vector2 *result;
 
   arg1 = (Dali::PanGesture *)jarg1;
   {
     try {
-      result = ((Dali::PanGesture const *)arg1)->GetScreenVelocity();
+      result = (Dali::Vector2 *)&(((Dali::PanGesture const *)arg1)->GetScreenVelocity());
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -15640,7 +15640,7 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_screenVelocity_get(void * j
       };
     }
   }
-  jresult = new Dali::Vector2((const Dali::Vector2 &)result);
+  jresult = (void *)result;
   return jresult;
 }
 
@@ -15648,12 +15648,12 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_screenVelocity_get(void * j
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_screenDisplacement_get(void * jarg1) {
   void * jresult ;
   Dali::PanGesture *arg1 = (Dali::PanGesture *) 0 ;
-  Dali::Vector2 result;
+  Dali::Vector2 *result;
 
   arg1 = (Dali::PanGesture *)jarg1;
   {
     try {
-      result = ((Dali::PanGesture const *)arg1)->GetScreenDisplacement();
+      result = (Dali::Vector2 *)&(((Dali::PanGesture const *)arg1)->GetScreenDisplacement());
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -15672,20 +15672,21 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_screenDisplacement_get(void
       };
     }
   }
-  jresult = new Dali::Vector2((const Dali::Vector2 &)result);
+  jresult = (void *)result;
   return jresult;
 }
 
 
+
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_screenPosition_get(void * jarg1) {
   void * jresult ;
   Dali::PanGesture *arg1 = (Dali::PanGesture *) 0 ;
-  Dali::Vector2 result;
+  Dali::Vector2 *result;
 
   arg1 = (Dali::PanGesture *)jarg1;
   {
     try {
-      result = ((Dali::PanGesture const *)arg1)->GetScreenPosition();
+      result = (Dali::Vector2 *)&(((Dali::PanGesture const *)arg1)->GetScreenPosition());
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -15704,11 +15705,12 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PanGesture_screenPosition_get(void * j
       };
     }
   }
-  jresult = new Dali::Vector2((const Dali::Vector2 &)result);
+  jresult = (void *)result;
   return jresult;
 }
 
 
+
 SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Dali_PanGesture_numberOfTouches_get(void * jarg1) {
   unsigned int jresult ;
   Dali::PanGesture *arg1 = (Dali::PanGesture *) 0 ;
@@ -15939,12 +15941,12 @@ SWIGEXPORT float SWIGSTDCALL CSharp_Dali_PinchGesture_speed_get(void * jarg1) {
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PinchGesture_screenCenterPoint_get(void * jarg1) {
   void * jresult ;
   Dali::PinchGesture *arg1 = (Dali::PinchGesture *) 0 ;
-  Dali::Vector2 result;
+  Dali::Vector2 *result;
 
   arg1 = (Dali::PinchGesture *)jarg1;
   {
     try {
-      result = ((Dali::PinchGesture const *)arg1)->GetScreenCenterPoint();
+      result = (Dali::Vector2 *)&(((Dali::PinchGesture const *)arg1)->GetScreenCenterPoint());
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -15963,7 +15965,7 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PinchGesture_screenCenterPoint_get(voi
       };
     }
   }
-  jresult = new Dali::Vector2((const Dali::Vector2 &)result);
+  jresult = (void *)result;
   return jresult;
 }
 
@@ -15971,12 +15973,12 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PinchGesture_screenCenterPoint_get(voi
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PinchGesture_localCenterPoint_get(void * jarg1) {
   void * jresult ;
   Dali::PinchGesture *arg1 = (Dali::PinchGesture *) 0 ;
-  Dali::Vector2 result;
+  Dali::Vector2 *result;
 
   arg1 = (Dali::PinchGesture *)jarg1;
   {
     try {
-      result = ((Dali::PinchGesture const *)arg1)->GetLocalCenterPoint();
+      result = (Dali::Vector2 *)&(((Dali::PinchGesture const *)arg1)->GetLocalCenterPoint());
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -15995,7 +15997,7 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_PinchGesture_localCenterPoint_get(void
       };
     }
   }
-  jresult = new Dali::Vector2((const Dali::Vector2 &)result);
+  jresult = (void *)result;
   return jresult;
 }
 
@@ -16226,12 +16228,12 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Dali_TapGesture_numberOfTouches_get(v
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_TapGesture_screenPoint_get(void * jarg1) {
   void * jresult ;
   Dali::TapGesture *arg1 = (Dali::TapGesture *) 0 ;
-  Dali::Vector2 result;
+  Dali::Vector2 *result;
 
   arg1 = (Dali::TapGesture *)jarg1;
   {
     try {
-      result = ((Dali::TapGesture const *)arg1)->GetScreenPoint();
+      result = (Dali::Vector2 *)&(((Dali::TapGesture const *)arg1)->GetScreenPoint());
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -16250,7 +16252,7 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_TapGesture_screenPoint_get(void * jarg
       };
     }
   }
-  jresult = new Dali::Vector2((const Dali::Vector2 &)result);
+  jresult = (void *)result;
   return jresult;
 }
 
@@ -16258,12 +16260,12 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_TapGesture_screenPoint_get(void * jarg
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_TapGesture_localPoint_get(void * jarg1) {
   void * jresult ;
   Dali::TapGesture *arg1 = (Dali::TapGesture *) 0 ;
-  Dali::Vector2 result;
+  Dali::Vector2 *result;
 
   arg1 = (Dali::TapGesture *)jarg1;
   {
     try {
-      result = ((Dali::TapGesture const *)arg1)->GetLocalPoint();
+      result = (Dali::Vector2 *)&(((Dali::TapGesture const *)arg1)->GetLocalPoint());
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -16282,7 +16284,7 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_TapGesture_localPoint_get(void * jarg1
       };
     }
   }
-  jresult = new Dali::Vector2((const Dali::Vector2 &)result);
+  jresult = (void *)result;
   return jresult;
 }
 
index d136370..3ee8195 100755 (executable)
@@ -195,30 +195,30 @@ SWIGEXPORT float SWIGSTDCALL CSharp_Dali_RotationGesture_rotation_get(void * jar
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_RotationGesture_screenCenterPoint_get(void * jarg1) {
   void * jresult ;
   Dali::RotationGesture *arg1 = (Dali::RotationGesture *) 0 ;
-  Dali::Vector2 result;
+  Dali::Vector2 *result;
 
   arg1 = (Dali::RotationGesture *)jarg1;
   {
     try {
-      result = ((Dali::RotationGesture const *)arg1)->GetScreenCenterPoint();
+      result = (Dali::Vector2 *)&(((Dali::RotationGesture const *)arg1)->GetScreenCenterPoint());
     } CALL_CATCH_EXCEPTION(0);
   }
-  jresult = new Dali::Vector2((const Dali::Vector2 &)result);
+  jresult = (void *)result;
   return jresult;
 }
 
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_RotationGesture_localCenterPoint_get(void * jarg1) {
   void * jresult ;
   Dali::RotationGesture *arg1 = (Dali::RotationGesture *) 0 ;
-  Dali::Vector2 result;
+  Dali::Vector2 *result;
 
   arg1 = (Dali::RotationGesture *)jarg1;
   {
     try {
-      result = ((Dali::RotationGesture const *)arg1)->GetLocalCenterPoint();
+      result = (Dali::Vector2 *)&(((Dali::RotationGesture const *)arg1)->GetLocalCenterPoint());
     } CALL_CATCH_EXCEPTION(0);
   }
-  jresult = new Dali::Vector2((const Dali::Vector2 &)result);
+  jresult = (void *)result;
   return jresult;
 }
 
@@ -345,4 +345,3 @@ SWIGEXPORT void SWIGSTDCALL CSharp_Dali_delete_RotationGestureDetectedSignal(voi
 #ifdef __cplusplus
 }
 #endif
-