Revert "[Tizen] animation callback dispose fix & remove version check" 68/144068/1
authorminho.sun <minho.sun@samsung.com>
Mon, 14 Aug 2017 07:47:07 +0000 (16:47 +0900)
committerminho.sun <minho.sun@samsung.com>
Mon, 14 Aug 2017 07:47:09 +0000 (16:47 +0900)
This reverts commit aad00ad962bd9a09d4829aa47bc42c8962804ccc.

Change-Id: I4856912c5c084e724bfe1871413a508ede20aa18

Tizen.NUI/src/internal/Application.cs
Tizen.NUI/src/public/Animation.cs
Tizen.NUI/src/public/Window.cs

index 91b60e4..4e68bfe 100755 (executable)
@@ -20,6 +20,18 @@ namespace Tizen.NUI
     using System;
     using System.Runtime.InteropServices;
 
+    //This version should be updated and synced for every Dali native release
+    internal static class Version
+    {
+        public const int ver1 = 1;
+        public const int ver2 = 2;
+        public const int ver3 = 46;
+        public const int nuiVer1 = 0;
+        public const int nuiVer2 = 2;
+        public const int nuiVer3 = 47;
+        public const string nuiRelease = "";
+    }
+
     /**
       * @brief Event arguments that passed via NUIApplicationInit signal
       *
@@ -1066,6 +1078,37 @@ namespace Tizen.NUI
 
         public static Application NewApplication(string stylesheet, Application.WindowMode windowMode)
         {
+            {
+                int ver1 = -1;
+                int ver2 = -1;
+                int ver3 = -1;
+
+                try
+                {
+                    if (NDalicManualPINVOKE.NativeVersionCheck(ref ver1, ref ver2, ref ver3))
+                    {
+                        if (ver1 != Version.ver1 || ver2 != Version.ver2 || ver3 != Version.ver3)
+                        {
+                            //throw new System.InvalidOperationException("Dali native version mismatch error! nui=" + Version.ver1 + "." + Version.ver2 + "." + Version.ver3 + " but dali=" + ver1 + "." + ver2 + "." + ver3);
+                            NUILog.Error("Dali native version mismatch error! nui=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease + " but native dali=" + ver1 + "." + ver2 + "." + ver3);
+                        }
+                    }
+                    else
+                    {
+                        //throw new System.InvalidOperationException("Dali native version mismatch error! nui=" + Version.ver1 + "." + Version.ver2 + "." + Version.ver3 + " but dali=" + ver1 + "." + ver2 + "." + ver3);
+                        NUILog.Error("Dali native version mismatch error! nui=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease + " but native dali=" + ver1 + "." + ver2 + "." + ver3);
+                    }
+                }
+                catch (Exception exc)
+                {
+                    //throw new System.InvalidOperationException("Dali native version is very old! nui=" + Version.ver1 + "." + Version.ver2 + "." + Version.ver3);
+                    NUILog.Error("Dali native version is very old! nui=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease);
+                    NUILog.Error("exception occured! =" + exc.Message);
+                }
+                NUILog.Debug(" Dali native version=" + ver1 + "." + ver2 + "." + ver3 + "      NUI version=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease);
+            }
+            NUILog.Debug(" NewApplication(string stylesheet, Application.WindowMode windowMode) is called! ");
+
             // register all Views with the type registry, so that can be created / styled via JSON
             //ViewRegistryHelper.Initialize(); //moved to Application side.
 
index aa4e8a1..3169ad3 100755 (executable)
@@ -58,22 +58,26 @@ namespace Tizen.NUI
                 //Called by User
                 //Release your own managed resources here.
                 //You should release all of your own disposable objects here.
-
+                NUILog.Debug("Animation.Dispose(Explicit)! GetState=" + this.GetState());
+                if(this.GetState() != States.Stopped)
+                {
+                    this.Clear();
+                    this.Reset();
+                    NUILog.Error("Now Animation is playing! Clear and Reset here!");
+                }
             }
             else if(type == DisposeTypes.Implicit)
             {
-
-            }
-
-            if(this)
-            {
-                this.Clear();
-                this.Reset();
-                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");
+                NUILog.Debug("Animation.Dispose(Implicit)! GetState=" + this.GetState());
+                if(this.GetState() != States.Stopped)
+                {
+                    this.Clear();
+                    this.Reset();
+                    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");
+                }
             }
 
-
             //Release your own unmanaged resources here.
             //You should not access any managed member here except static instance.
             //because the execution order of Finalizes is non-deterministic.
@@ -118,11 +122,18 @@ namespace Tizen.NUI
             {
                 if (_animationFinishedEventHandler == null)
                 {
-                    NUILog.Debug("[add before]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
+#if DEBUG_ON
+                    Tizen.Log.Debug("NUI", "con1) FinishedSignal().Empty = " + FinishedSignal().Empty());
+                    Tizen.Log.Debug("NUI", "con2) FinishedSignal().GetConnectionCount = " + FinishedSignal().GetConnectionCount());
+#endif
                     _animationFinishedEventCallback = OnFinished;
                     FinishedSignal().Connect(_animationFinishedEventCallback);
-                    NUILog.Debug("[add after]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
+#if DEBUG_ON
+                    Tizen.Log.Debug("NUI", "con3) FinishedSignal().Empty = " + FinishedSignal().Empty());
+                    Tizen.Log.Debug("NUI", "con4) FinishedSignal().GetConnectionCount = " + FinishedSignal().GetConnectionCount());
+#endif
                 }
+
                 _animationFinishedEventHandler += value;
             }
             remove
@@ -131,9 +142,15 @@ namespace Tizen.NUI
 
                 if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false)
                 {
-                    NUILog.Debug("[remove before]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
+#if DEBUG_ON
+                    Tizen.Log.Debug("NUI", "discon1) FinishedSignal().Empty = " + FinishedSignal().Empty());
+                    Tizen.Log.Debug("NUI", "discon2) FinishedSignal().GetConnectionCount = " + FinishedSignal().GetConnectionCount());
+#endif
                     FinishedSignal().Disconnect(_animationFinishedEventCallback);
-                    NUILog.Debug("[remove after]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
+#if DEBUG_ON
+                    Tizen.Log.Debug("NUI", "discon3) FinishedSignal().Empty = " + FinishedSignal().Empty());
+                    Tizen.Log.Debug("NUI", "discon4) FinishedSignal().GetConnectionCount = " + FinishedSignal().GetConnectionCount());
+#endif
                 }
             }
         }
@@ -160,10 +177,16 @@ namespace Tizen.NUI
             {
                 if (_animationProgressReachedEventHandler == null)
                 {
-                    NUILog.Debug("[add before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
+#if DEBUG_ON
+                    Tizen.Log.Debug("NUI", "con1) ProgressReachedSignal().Empty = " + ProgressReachedSignal().Empty());
+                    Tizen.Log.Debug("NUI", "con2) ProgressReachedSignal().GetConnectionCount = " + ProgressReachedSignal().GetConnectionCount());
+#endif
                     _animationProgressReachedEventCallback = OnProgressReached;
                     ProgressReachedSignal().Connect(_animationProgressReachedEventCallback);
-                    NUILog.Debug("[add after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
+#if DEBUG_ON
+                    Tizen.Log.Debug("NUI", "con3) ProgressReachedSignal().Empty = " + ProgressReachedSignal().Empty());
+                    Tizen.Log.Debug("NUI", "con4) ProgressReachedSignal().GetConnectionCount = " + ProgressReachedSignal().GetConnectionCount());
+#endif
                 }
 
                 _animationProgressReachedEventHandler += value;
@@ -174,9 +197,15 @@ namespace Tizen.NUI
 
                 if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false)
                 {
-                    NUILog.Debug("[remove before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
+#if DEBUG_ON
+                    Tizen.Log.Debug("NUI", "discon1) ProgressReachedSignal().Empty = " + ProgressReachedSignal().Empty());
+                    Tizen.Log.Debug("NUI", "discon2) ProgressReachedSignal().GetConnectionCount = " + ProgressReachedSignal().GetConnectionCount());
+#endif
                     ProgressReachedSignal().Disconnect(_animationProgressReachedEventHandler);
-                    NUILog.Debug("[remove after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
+#if DEBUG_ON
+                    Tizen.Log.Debug("NUI", "discon3) ProgressReachedSignal().Empty = " + ProgressReachedSignal().Empty());
+                    Tizen.Log.Debug("NUI", "discon4) ProgressReachedSignal().GetConnectionCount = " + ProgressReachedSignal().GetConnectionCount());
+#endif
                 }
             }
         }
index 8e0fdb0..6a1e21a 100755 (executable)
@@ -94,20 +94,14 @@ namespace Tizen.NUI
             return ret;
        }
 
-        /// <summary>
-        /// Sets whether window accepts focus or not.
-        /// </summary>
-        /// <param name="accept">If focus is accepted or not. Default is true.</param>
+        [Obsolete("Please do not use! this will be internal method")]
         public void SetAcceptFocus(bool accept)
         {
             NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        /// <summary>
-        /// Returns whether window accepts focus or not.
-        /// </summary>
-        /// <returns>True if the window accept focus, false otherwise</returns>
+        [Obsolete("Please do not use! this will be internal method")]
         public bool IsFocusAcceptable()
         {
             return NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
@@ -1343,7 +1337,7 @@ namespace Tizen.NUI
         private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
         private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler2;
 
-        [Obsolete("Please do not use! this will be deprecated. Please use 'FocusChanged' event instead")]
+        [Obsolete("Please do not use! this will be deprecated")]
         public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
         {
             add