From 9fa931e0b503256756eb673894134fbf61f2c9b8 Mon Sep 17 00:00:00 2001 From: "dongsug.song" Date: Fri, 2 Dec 2022 20:53:12 +0900 Subject: [PATCH] [NUI] Add implicit dispose check --- src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs | 6 ++++++ src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs | 7 ++----- src/Tizen.NUI/src/public/BaseHandle.cs | 11 ++++++++++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs index 3a50044..4c15cca 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs @@ -919,6 +919,12 @@ namespace Tizen.NUI.BaseComponents // Callback for View TouchSignal private bool OnTouch(IntPtr view, IntPtr touchData) { + if (IsDisposeQueued) + { + NUILog.Error("implicit disposed(unreachable)! just return here!"); + return true; + } + if (touchData == global::System.IntPtr.Zero) { NUILog.Error("touchData should not be null!"); diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs index a6f142a..77113d1 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs @@ -1131,10 +1131,8 @@ 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 (this != null) - { - DisConnectFromSignals(); - } + + DisConnectFromSignals(); foreach (View view in Children) { @@ -1404,7 +1402,6 @@ namespace Tizen.NUI.BaseComponents { SizeModeFactor = new Vector3(x, y, z); } - private void UpdateShadowCornerRadius(float value) { // TODO Update corner radius property only whe DALi supports visual property update. diff --git a/src/Tizen.NUI/src/public/BaseHandle.cs b/src/Tizen.NUI/src/public/BaseHandle.cs index a7d6084..5cbf668 100755 --- a/src/Tizen.NUI/src/public/BaseHandle.cs +++ b/src/Tizen.NUI/src/public/BaseHandle.cs @@ -439,6 +439,11 @@ namespace Tizen.NUI internal void NotifyPropertyChanged([CallerMemberName] String propertyName = "") { + if (isDisposeQueued) + { + NUILog.Error("implicit disposed(unreachable)! just return here!"); + return; + } PropertySet?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } @@ -453,6 +458,8 @@ namespace Tizen.NUI return; } + PropertySet = null; + if (type == DisposeTypes.Explicit) { //Called by User @@ -471,7 +478,7 @@ namespace Tizen.NUI Registry.Unregister(this); } - if(swigCPtr.Handle != IntPtr.Zero) + if (swigCPtr.Handle != IntPtr.Zero) { if (swigCMemOwn) { @@ -528,6 +535,8 @@ namespace Tizen.NUI /// Hidden API: Only for inhouse or developing usage. The behavior and interface can be changed anytime. [EditorBrowsable(EditorBrowsableState.Never)] protected internal bool Disposed => disposed; + + protected internal bool IsDisposeQueued => isDisposeQueued; } } -- 2.7.4