[NUI] Fix View.HasFocus crash issue (#840)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Mon, 20 May 2019 06:18:23 +0000 (15:18 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Mon, 20 May 2019 06:18:23 +0000 (15:18 +0900)
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/View.cs

index 8f66348352bbdaef3d570e54b747cbb6993f0651..98d7b002065df8dd82b9d8aaf840b1e18b3b1342 100755 (executable)
@@ -2536,8 +2536,16 @@ namespace Tizen.NUI.BaseComponents
         /// <since_tizen> 3 </since_tizen>
         public bool HasFocus()
         {
-            bool ret = NDalicPINVOKE.View_HasKeyInputFocus(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            bool ret = false;
+            if (swigCPtr.Handle != global::System.IntPtr.Zero)
+            {
+                ret = NDalicPINVOKE.View_HasKeyInputFocus(swigCPtr);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            }
+            else
+            {
+                Tizen.Log.Error("NUI", "swigCPtr of view is aleady disposed.");
+            }
             return ret;
         }