[NUI] Add defense code for BaseHandle (#2069)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Mon, 5 Oct 2020 09:39:46 +0000 (18:39 +0900)
committerGitHub <noreply@github.com>
Mon, 5 Oct 2020 09:39:46 +0000 (18:39 +0900)
* [NUI] Add defense code for BaseHandle

 vd kona - DF200925-00594
Check if the swigCptr value is correct after the dispose.

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* Update BaseHandle.cs

* Update BaseHandle.cs

src/Tizen.NUI/src/public/BaseHandle.cs

index 816611a..95bac96 100755 (executable)
@@ -400,11 +400,18 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         public bool HasBody()
         {
-            if (disposed == true)
+            if (swigCPtrCopy.Handle == IntPtr.Zero)
             {
+                global::System.Diagnostics.StackTrace trace = new global::System.Diagnostics.StackTrace();
+                Tizen.Log.Error("NUI", "" + trace);
+                Tizen.Log.Error("NUI", "[ERROR] the native handle is invalid!");
                 return false;
             }
 
+            if (disposed == true)
+            {
+                return false;
+            }
             bool ret = Interop.BaseHandle.BaseHandle_HasBody(swigCPtrCopy);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;