[NUI] fix testhub fail, Add Dispose() in BaseHandle.Reset() where the body was delete...
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Common / BaseHandle.cs
index 0da5f74..f221e0a 100755 (executable)
@@ -432,10 +432,13 @@ namespace Tizen.NUI
         /// Resets the handle.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
+        /// <remark>
+        /// This will be deprecated, please use Dispose() instead.
+        /// </remark>
         public void Reset()
         {
-            Interop.BaseHandle.Reset(swigCPtrCopy);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            this.Dispose();
+            NUILog.Error("[ERROR] This(BaseHandle.Reset) will be deprecated, please use Dispose() instead!");
         }
 
         /// <summary>
@@ -493,7 +496,7 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         public bool IsEqual(BaseHandle rhs)
         {
-            if (disposed == true)
+            if (disposed == true || rhs == null || !rhs.HasBody())
             {
                 return false;
             }
@@ -624,6 +627,15 @@ namespace Tizen.NUI
                         $"OR the native dali object handle of NUI becomes null! \n" +
                         $" process:{process} thread:{thread}, isDisposed:{this.disposed}, isDisposeQueued:{this.isDisposeQueued}, me:{me}\n");
 
+                    Tizen.Log.Fatal("NUI", $"[ERROR] back trace!");
+                    global::System.Diagnostics.StackTrace st = new global::System.Diagnostics.StackTrace(true);
+                    for (int i = 0; i < st.FrameCount; i++)
+                    {
+                        global::System.Diagnostics.StackFrame sf = st.GetFrame(i);
+                        Tizen.Log.Fatal("NUI", " Method " + sf.GetMethod());
+                    }
+                    Tizen.Log.Fatal("NUI", "Error! just return here with null swigCPtr! this can cause unknown error or crash in next step");
+
                     //to fix ArtApp black screen issue. this will be enabled after talking with ArtApp team and fixing it.
                     // throw new ObjectDisposedException(nameof(SwigCPtr), $"Error! NUI's native dali object is already disposed. " +
                     //     $"OR the native dali object handle of NUI becomes null! \n" +
@@ -656,7 +668,7 @@ namespace Tizen.NUI
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected internal bool IsDisposeQueued => isDisposeQueued;
 
-        [Conditional("NUI_DEBUG_ON")]
+        [Conditional("NUI_DISPOSE_DEBUG_ON")]
         private void disposeDebuggingCtor()
         {
             DebugFileLogging.Instance.WriteLog($"type:{GetType()} copyNativeHandle:{swigCPtrCopy.Handle.ToString("X8")}");
@@ -673,7 +685,7 @@ namespace Tizen.NUI
             }
         }
 
-        [Conditional("NUI_DEBUG_ON")]
+        [Conditional("NUI_DISPOSE_DEBUG_ON")]
         private void disposeDebuggingDispose(DisposeTypes type)
         {
             DebugFileLogging.Instance.WriteLog($"swigCMemOwn:{swigCMemOwn} type:{GetType()} copyNativeHandle:{swigCPtrCopy.Handle.ToString("X8")} HasBody:{HasBody()}");