[4.0] depense code for TriggerEvent::Triggered callback null-reference issue 88/163788/1
authordongsug.song <dongsug.song@samsung.com>
Wed, 13 Dec 2017 10:08:18 +0000 (19:08 +0900)
committerhuiyu,eun <huiyu.eun@samsung.com>
Wed, 13 Dec 2017 10:15:17 +0000 (19:15 +0900)
Change-Id: I89dc2920dccec2243fb5562ee8b61caacc4b73b7
Signed-off-by: huiyu,eun <huiyu.eun@samsung.com>
src/Tizen.NUI/src/internal/Application.cs
src/Tizen.NUI/src/internal/DisposeQueue.cs
src/Tizen.NUI/src/internal/EventThreadCallback.cs
src/Tizen.NUI/src/internal/Registry.cs
src/Tizen.NUI/src/public/NUIApplication.cs
src/Tizen.NUI/src/public/Property.cs

index f74d695..b6174b0 100755 (executable)
@@ -520,8 +520,6 @@ namespace Tizen.NUI
                 Tizen.Log.Fatal("NUI", "Dali and NUI are version mismatched!");
             }
 
-            // Initialize DisposeQueue Singleton class. This is also required to create DisposeQueue on main thread.
-            DisposeQueue.Instance.Initialize();
             NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs();
 
             // Populate all members of "e" (NUIApplicationInitEventArgs) with real data
@@ -532,6 +530,9 @@ namespace Tizen.NUI
                 //here we send all data to user event handlers
                 _applicationInitEventHandler(this, e);
             }
+
+            // Initialize DisposeQueue Singleton class. This is also required to create DisposeQueue on main thread.
+            DisposeQueue.Instance.Initialize();
         }
 
         /**
index 7c06194..1fb4e69 100755 (executable)
@@ -19,7 +19,7 @@ namespace Tizen.NUI
         private List<IDisposable> _disposables = new List<IDisposable>();
         private System.Object _listLock = new object();
         private EventThreadCallback _eventThreadCallback;
-        private EventThreadCallback.CallbackDelegate _disposeQueueProcessDisposablesDelegate;
+        private static EventThreadCallback.CallbackDelegate _disposeQueueProcessDisposablesDelegate;
 
         private DisposeQueue()
         {
@@ -34,10 +34,15 @@ namespace Tizen.NUI
             get { return _disposableQueue; }
         }
 
+        private bool _isCalled = false;
         public void Initialize()
         {
+            if(_isCalled == false)
+            {
             _disposeQueueProcessDisposablesDelegate = new EventThreadCallback.CallbackDelegate(ProcessDisposables);
             _eventThreadCallback = new EventThreadCallback(_disposeQueueProcessDisposablesDelegate);
+                _isCalled = true;
+            }
         }
 
         public void Add(IDisposable disposable)
@@ -64,5 +69,14 @@ namespace Tizen.NUI
                 _disposables.Clear();
             }
         }
+
+        internal int CurruntAccumulatedDisposableObjects
+        {
+            get
+            {
+                return _disposables.Count;
+            }
+        }
+
     }
 }
index 55b9175..3c1a2d6 100755 (executable)
@@ -24,6 +24,7 @@ namespace Tizen.NUI
         protected bool swigCMemOwn;
         /// <since_tizen> 3 </since_tizen>
         public delegate void CallbackDelegate();
+        private const int THREASHOLD = 100;
 
         internal EventThreadCallback(global::System.IntPtr cPtr, bool cMemoryOwn)
         {
@@ -112,7 +113,10 @@ namespace Tizen.NUI
         {
             if ((System.IntPtr)swigCPtr != global::System.IntPtr.Zero)
             {
-                NDalicManualPINVOKE.EventThreadCallback_Trigger(swigCPtr);
+                if(DisposeQueue.Instance.CurruntAccumulatedDisposableObjects > THREASHOLD)
+                {
+                    NDalicManualPINVOKE.EventThreadCallback_Trigger(swigCPtr);
+                }
             }
 
             if (NDalicPINVOKE.SWIGPendingException.Pending)
index aea7cbe..ab27d30 100755 (executable)
@@ -64,7 +64,7 @@ namespace Tizen.NUI
             RefObject refObj = baseHandle.GetObjectPtr();
             IntPtr refCptr = (IntPtr)RefObject.getCPtr(refObj);
 
-            NUILog.Debug("Storing ref object cptr in control map Hex: {0:X}" + refCptr);
+            //NUILog.Debug("Storing ref object cptr in control map Hex: {0:X}" + refCptr);
 
             if (!Instance._controlMap.ContainsKey(refCptr))
             {
index 3b70b65..6dc58ea 100755 (executable)
@@ -168,9 +168,6 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         protected override void OnCreate()
         {
-            // This is also required to create DisposeQueue on main thread.
-            DisposeQueue disposeQ = DisposeQueue.Instance;
-            disposeQ.Initialize();
             base.OnCreate();
 
             // Dali's default layer is default center origin. need to change as top left.
index ae904d7..98cd07c 100755 (executable)
@@ -1302,7 +1302,7 @@ namespace Tizen.NUI
             {
                 throw new global::System.InvalidOperationException("Unimplemented type for Property Value :" + type.Name);
             }
-            NUILog.Debug(" got an property value of =" + type.Name);
+            //NUILog.Debug(" got an property value of =" + type.Name);
             return value;
         }