[NUI] Add protect codes in Dispose() 00/165600/2
authoradun <xiaohui.fang@samsung.com>
Tue, 2 Jan 2018 18:47:08 +0000 (02:47 +0800)
committerdongsug song <dongsug.song@samsung.com>
Wed, 3 Jan 2018 11:21:18 +0000 (11:21 +0000)
Change-Id: I965de0e538e0b07a83a757e9c860fc11991f4903

13 files changed:
src/Tizen.NUI/src/public/Animation.cs
src/Tizen.NUI/src/public/BaseComponents/Scrollable.cs
src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
src/Tizen.NUI/src/public/BaseComponents/TextField.cs
src/Tizen.NUI/src/public/BaseComponents/VideoView.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/Timer.cs
src/Tizen.NUI/src/public/UIComponents/Button.cs
src/Tizen.NUI/src/public/UIComponents/Popup.cs
src/Tizen.NUI/src/public/UIComponents/ProgressBar.cs
src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs
src/Tizen.NUI/src/public/UIComponents/ScrollView.cs
src/Tizen.NUI/src/public/UIComponents/Slider.cs

index f42b199..c079d5b 100755 (executable)
@@ -53,15 +53,18 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         protected override void Dispose(DisposeTypes type)
         {
-            if (_animationFinishedEventCallback != null)
+            if (this != null)
             {
-                FinishedSignal().Disconnect(_finishedCallbackOfNative);
-            }
+                if (_animationFinishedEventCallback != null)
+                {
+                    FinishedSignal().Disconnect(_finishedCallbackOfNative);
+                }
 
-            if (_animationProgressReachedEventCallback != null)
-            {
+                if (_animationProgressReachedEventCallback != null)
+                {
 
-                ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
+                    ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
+                }
             }
 
             if(disposed)
index 83093a0..1d5c589 100755 (executable)
@@ -63,8 +63,10 @@ namespace Tizen.NUI.BaseComponents
             //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.
-
-            DisConnectFromSignals();
+            if (this != null)
+            {
+                DisConnectFromSignals();
+            }
 
             if (swigCPtr.Handle != global::System.IntPtr.Zero)
             {
index d918fda..e5a687c 100755 (executable)
@@ -68,7 +68,7 @@ namespace Tizen.NUI.BaseComponents
             //You should not access any managed member here except static instance.
             //because the execution order of Finalizes is non-deterministic.
 
-            if (_textEditorTextChangedCallbackDelegate != null)
+            if (this != null && _textEditorTextChangedCallbackDelegate != null)
             {
                 TextChangedSignal().Disconnect(_textEditorTextChangedCallbackDelegate);
             }
index 7684af7..4175dae 100755 (executable)
@@ -67,15 +67,17 @@ namespace Tizen.NUI.BaseComponents
             //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.
-
-            if (_textFieldMaxLengthReachedCallbackDelegate != null)
+            if (this != null)
             {
-                this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
-            }
+                if (_textFieldMaxLengthReachedCallbackDelegate != null)
+                {
+                    this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
+                }
 
-            if (_textFieldTextChangedCallbackDelegate != null)
-            {
-                TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
+                if (_textFieldTextChangedCallbackDelegate != null)
+                {
+                    TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
+                }
             }
 
             if (swigCPtr.Handle != global::System.IntPtr.Zero)
index 4c15f39..f17dd45 100755 (executable)
@@ -61,7 +61,7 @@ namespace Tizen.NUI.BaseComponents
             //You should not access any managed member here except static instance.
             //because the execution order of Finalizes is non-deterministic.
 
-            if (_videoViewFinishedCallbackDelegate != null)
+            if (this != null && _videoViewFinishedCallbackDelegate != null)
             {
                 FinishedSignal().Disconnect(_videoViewFinishedCallbackDelegate);
             }
index fe56b64..78667e0 100755 (executable)
@@ -145,8 +145,10 @@ namespace Tizen.NUI.BaseComponents
             //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.
-
-            DisConnectFromSignals();
+            if (this != null)
+            {
+                DisConnectFromSignals();
+            }
 
             if (swigCPtr.Handle != global::System.IntPtr.Zero)
             {
index 3ca9ff4..52cb554 100755 (executable)
@@ -66,7 +66,7 @@ namespace Tizen.NUI
         {
             NUILog.Debug($"(0x{swigCPtr.Handle:X}) Timer.Dispose(type={type}, disposed={disposed})");
 
-            if (_timerTickCallbackDelegate != null)
+            if (this != null && _timerTickCallbackDelegate != null)
             {
                 TickSignal().Disconnect(_timerTickCallbackOfNative);
             }
index 636eddb..8c59293 100755 (executable)
@@ -72,8 +72,10 @@ namespace Tizen.NUI.UIComponents
             //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.
-
-            DisConnectFromSignals();
+            if (this != null)
+            {
+                DisConnectFromSignals();
+            }
 
             if (swigCPtr.Handle != global::System.IntPtr.Zero)
             {
index 3da49bf..0b81c5a 100755 (executable)
@@ -62,15 +62,17 @@ namespace Tizen.NUI.UIComponents
             //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.
-
-            if (_popUpHiddenEventCallbackDelegate != null)
+            if (this != null)
             {
-                HiddenSignal().Disconnect(_popUpHiddenEventCallbackDelegate);
-            }
+                if (_popUpHiddenEventCallbackDelegate != null)
+                {
+                    HiddenSignal().Disconnect(_popUpHiddenEventCallbackDelegate);
+                }
 
-            if (_popUpHidingEventCallbackDelegate != null)
-            {
-                HidingSignal().Disconnect(_popUpHidingEventCallbackDelegate);
+                if (_popUpHidingEventCallbackDelegate != null)
+                {
+                    HidingSignal().Disconnect(_popUpHidingEventCallbackDelegate);
+                }
             }
 
             if (_popUpShownEventCallbackDelegate != null)
index 3d88973..4a280b3 100755 (executable)
@@ -63,7 +63,7 @@ namespace Tizen.NUI.UIComponents
             //You should not access any managed member here except static instance.
             //because the execution order of Finalizes is non-deterministic.
 
-            if (_progressBarValueChangedCallbackDelegate != null)
+            if (this != null && _progressBarValueChangedCallbackDelegate != null)
             {
                 ValueChangedSignal().Disconnect(_progressBarValueChangedCallbackDelegate);
             }
index e2d752d..44c39de 100755 (executable)
@@ -61,15 +61,17 @@ namespace Tizen.NUI.UIComponents
             //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.
-
-            if (_scrollBarScrollPositionIntervalReachedEventCallbackDelegate != null)
+            if (this != null)
             {
-                ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
-            }
+                if (_scrollBarScrollPositionIntervalReachedEventCallbackDelegate != null)
+                {
+                    ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
+                }
 
-            if (_scrollBarPanFinishedEventCallbackDelegate != null)
-            {
-                PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate);
+                if (_scrollBarPanFinishedEventCallbackDelegate != null)
+                {
+                    PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate);
+                }
             }
 
             if (swigCPtr.Handle != global::System.IntPtr.Zero)
index cf4159b..3041525 100755 (executable)
@@ -64,7 +64,7 @@ namespace Tizen.NUI
             //You should not access any managed member here except static instance.
             //because the execution order of Finalizes is non-deterministic.
 
-            if (_scrollViewSnapStartedCallbackDelegate != null)
+            if (this != null && _scrollViewSnapStartedCallbackDelegate != null)
             {
                 this.SnapStartedSignal().Disconnect(_scrollViewSnapStartedCallbackDelegate);
             }
index 5e7e51a..322cb4a 100755 (executable)
@@ -62,20 +62,22 @@ namespace Tizen.NUI.UIComponents
             //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.
-
-            if (_sliderValueChangedCallbackDelegate != null)
+            if (this != null)
             {
-                ValueChangedSignal().Disconnect(_sliderValueChangedCallbackDelegate);
-            }
+                if (_sliderValueChangedCallbackDelegate != null)
+                {
+                    ValueChangedSignal().Disconnect(_sliderValueChangedCallbackDelegate);
+                }
 
-            if (_sliderSlidingFinishedCallbackDelegate != null)
-            {
-                SlidingFinishedSignal().Disconnect(_sliderSlidingFinishedCallbackDelegate);
-            }
+                if (_sliderSlidingFinishedCallbackDelegate != null)
+                {
+                    SlidingFinishedSignal().Disconnect(_sliderSlidingFinishedCallbackDelegate);
+                }
 
-            if (_sliderMarkReachedCallbackDelegate != null)
-            {
-                MarkReachedSignal().Disconnect(_sliderMarkReachedCallbackDelegate);
+                if (_sliderMarkReachedCallbackDelegate != null)
+                {
+                    MarkReachedSignal().Disconnect(_sliderMarkReachedCallbackDelegate);
+                }
             }
 
             if (swigCPtr.Handle != global::System.IntPtr.Zero)