[NUI] Revert "fix TCT crash issue" 23/164823/1
authordongsug.song <dongsug.song@samsung.com>
Thu, 21 Dec 2017 06:49:54 +0000 (15:49 +0900)
committerdongsug.song <dongsug.song@samsung.com>
Thu, 21 Dec 2017 06:50:14 +0000 (15:50 +0900)
This reverts commit 0a7c57d6c78d89eccb08c3ee1fb63df604cbec8d.

Change-Id: Ic66ecce10b99b9575a8c60956cdfd8c2e6baaf6a

src/Tizen.NUI/src/public/Animation.cs
src/Tizen.NUI/src/public/Timer.cs

index 75db7f9..aef2822 100755 (executable)
@@ -47,14 +47,6 @@ namespace Tizen.NUI
             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
         }
 
-        ~Animation()
-        {
-            if (_animationFinishedEventCallback != null)
-            {
-                _finishedSignal?.Disconnect(_finishedCallbackOfNative);
-            }
-        }
-
         /// <summary>
         /// To make animation instance be disposed.
         /// </summary>
@@ -63,11 +55,12 @@ namespace Tizen.NUI
         {
             if (_animationFinishedEventCallback != null)
             {
-                _finishedSignal?.Disconnect(_finishedCallbackOfNative);
+                FinishedSignal().Disconnect(_finishedCallbackOfNative);
             }
 
             if (_animationProgressReachedEventCallback != null)
             {
+
                 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
             }
 
@@ -75,7 +68,6 @@ namespace Tizen.NUI
             {
                 return;
             }
-
             if(type == DisposeTypes.Explicit)
             {
                 //Called by User
@@ -92,7 +84,7 @@ namespace Tizen.NUI
             {
                 this.Clear();
                 this.Reset();
-                NUILog.Error("Animation().Clear & Reset here!");
+                NUILog.Error("Now Animation is playing! Clear and Reset here!");
                 //throw new System.InvalidOperationException("Animation Instance should not be disposed until getting Finished event. Should be a global variable");
             }
 
@@ -133,7 +125,6 @@ namespace Tizen.NUI
         private event EventHandler _animationFinishedEventHandler;
 
         private System.IntPtr _finishedCallbackOfNative;
-        private AnimationSignal _finishedSignal;
 
         /**
         * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
@@ -146,8 +137,7 @@ namespace Tizen.NUI
             {
                 if (_animationFinishedEventHandler == null && disposed == false)
                 {
-                    _finishedSignal = FinishedSignal();
-                    _finishedSignal?.Connect(_finishedCallbackOfNative);
+                    FinishedSignal().Connect(_finishedCallbackOfNative);
                 }
                 _animationFinishedEventHandler += value;
             }
@@ -155,9 +145,9 @@ namespace Tizen.NUI
             {
                 _animationFinishedEventHandler -= value;
 
-                if (_animationFinishedEventHandler == null && _finishedSignal?.Empty() == false)
+                if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false)
                 {
-                    _finishedSignal?.Disconnect(_finishedCallbackOfNative);
+                    FinishedSignal().Disconnect(_finishedCallbackOfNative);
                 }
             }
         }
index 7d1824b..3ca9ff4 100755 (executable)
@@ -44,14 +44,13 @@ namespace Tizen.NUI
 
             _timerTickCallbackDelegate = OnTick;
             _timerTickCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(_timerTickCallbackDelegate);
+
+            NUILog.Debug($"(0x{swigCPtr.Handle:X})Timer() contructor!");
         }
 
         ~Timer()
         {
-            if (_timerTickCallbackDelegate != null)
-            {
-                _timerSignal?.Disconnect(_timerTickCallbackOfNative);
-            }
+            NUILog.Debug($"(0x{swigCPtr.Handle:X})Timer() distructor!, disposed={disposed}");
         }
 
         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Timer obj)
@@ -65,9 +64,11 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         protected override void Dispose(DisposeTypes type)
         {
+            NUILog.Debug($"(0x{swigCPtr.Handle:X}) Timer.Dispose(type={type}, disposed={disposed})");
+
             if (_timerTickCallbackDelegate != null)
             {
-                _timerSignal?.Disconnect(_timerTickCallbackOfNative);
+                TickSignal().Disconnect(_timerTickCallbackOfNative);
             }
 
             if (disposed)
@@ -115,7 +116,6 @@ namespace Tizen.NUI
         private TickCallbackDelegate _timerTickCallbackDelegate;
 
         private System.IntPtr _timerTickCallbackOfNative;
-        private TimerSignalType _timerSignal;
 
         /// <summary>
         /// @brief Event for the ticked signal, which can be used to subscribe or unsubscribe the event handler
@@ -128,17 +128,16 @@ namespace Tizen.NUI
             {
                 if (_timerTickEventHandler == null && disposed == false)
                 {
-                    _timerSignal = TickSignal();
-                    _timerSignal?.Connect(_timerTickCallbackOfNative);
+                    TickSignal().Connect(_timerTickCallbackOfNative);
                 }
                 _timerTickEventHandler += value;
             }
             remove
             {
                 _timerTickEventHandler -= value;
-                if (_timerTickEventHandler == null && _timerSignal?.Empty() == false)
+                if (_timerTickEventHandler == null && TickSignal().Empty() == false)
                 {
-                    _timerSignal?.Disconnect(_timerTickCallbackOfNative);
+                    TickSignal().Disconnect(_timerTickCallbackOfNative);
                 }
             }
         }
@@ -149,7 +148,7 @@ namespace Tizen.NUI
 
             if (played == false)
             {
-                Tizen.Log.Fatal("NUI", $"OnTick() is called even played is false!");
+                Tizen.Log.Fatal("NUI", $"(0x{swigCPtr.Handle:X}) OnTick() is called even played is false!");
                 //throw new System.InvalidOperationException($"OnTick() excpetion!");
             }
 
@@ -170,6 +169,8 @@ namespace Tizen.NUI
         public Timer(uint milliSec) : this(NDalicPINVOKE.Timer_New(milliSec), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+            NUILog.Debug($"(0x{swigCPtr.Handle:X})  Timer({milliSec}) Constructor!");
         }
         internal Timer(Timer timer) : this(NDalicPINVOKE.new_Timer__SWIG_1(Timer.getCPtr(timer)), true)
         {
@@ -227,6 +228,8 @@ namespace Tizen.NUI
         /// <param name="milliSec">MilliSec interval in milliseconds.</param>
         internal void SetInterval(uint milliSec)
         {
+            NUILog.Debug($"(0x{swigCPtr.Handle:X})SetInterval({milliSec})");
+
             played = true;
 
             NDalicPINVOKE.Timer_SetInterval(swigCPtr, milliSec);