[NUI] Add played flag to Timer class 14/162914/1 5.0.0-preview1-00403
authorhuiyu,eun <huiyu.eun@samsung.com>
Wed, 6 Dec 2017 07:21:13 +0000 (16:21 +0900)
committerhuiyu,eun <huiyu.eun@samsung.com>
Wed, 6 Dec 2017 07:21:13 +0000 (16:21 +0900)
Change-Id: I7370782a070d5709798b49a94866bd978cba4099
Signed-off-by: huiyu,eun <huiyu.eun@samsung.com>
src/Tizen.NUI/src/public/Timer.cs

index bd9aaff..cb1ffdc 100644 (file)
@@ -17,6 +17,7 @@
 using System;
 using System.Runtime.InteropServices;
 using System.ComponentModel;
+using System.Threading;
 
 namespace Tizen.NUI
 {
@@ -35,6 +36,9 @@ namespace Tizen.NUI
     {
         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
 
+        private bool played = false;
+        private string stackTrace;
+
         internal Timer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Timer_SWIGUpcast(cPtr), cMemoryOwn)
         {
             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
@@ -82,6 +86,7 @@ namespace Tizen.NUI
                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
             }
 
+            played = false;
             base.Dispose(type);
         }
 
@@ -110,7 +115,7 @@ namespace Tizen.NUI
             {
                 if (_timerTickEventHandler == null)
                 {
-                    _timerTickCallbackDelegate = (OnTick);
+                    _timerTickCallbackDelegate = new TickCallbackDelegate(OnTick);
                     TickSignal().Connect(_timerTickCallbackDelegate);
                 }
                 _timerTickEventHandler += value;
@@ -129,7 +134,14 @@ namespace Tizen.NUI
         {
             TickEventArgs e = new TickEventArgs();
 
-            if (_timerTickEventHandler != null)
+            if (played == false)
+            {
+                Tizen.Log.Fatal("NUI", $"should not be here! OnTick()!swigCPtr={swigCPtr.Handle}");
+                Tizen.Log.Fatal("NUI", "should not be here! #################### TID = " + global::System.Threading.Thread.CurrentThread.ManagedThreadId);
+                Tizen.Log.Fatal("NUI", stackTrace);
+            }
+
+            if (_timerTickEventHandler != null && played == true)
             {
                 //here we send all data to user event handlers
                 return _timerTickEventHandler(this, e);
@@ -145,6 +157,7 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         public Timer(uint milliSec) : this(NDalicPINVOKE.Timer_New(milliSec), true)
         {
+            stackTrace = Environment.StackTrace;
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
 
         }
@@ -175,7 +188,9 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         public void Start()
         {
+            played = true;
             NDalicPINVOKE.Timer_Start(swigCPtr);
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
@@ -185,7 +200,9 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         public void Stop()
         {
+            played = false;
             NDalicPINVOKE.Timer_Stop(swigCPtr);
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
@@ -244,4 +261,5 @@ namespace Tizen.NUI
 
     }
 
-}
\ No newline at end of file
+}
+