From 15302150c47ae1921abc5026224995706a6a84c5 Mon Sep 17 00:00:00 2001 From: "dongsug.song" Date: Tue, 7 Nov 2023 13:15:01 +0900 Subject: [PATCH] [NUI] revert 'Make DaliAccessibilityDetachAccessibleObject called at main thread' and check native object --- .../src/public/BaseComponents/ViewAccessibility.cs | 38 ++++++++++++++++++++-- .../src/public/BaseComponents/ViewInternal.cs | 6 ---- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs index 674586b..0b9ee80 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs @@ -256,7 +256,7 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public AccessibilityStates GetAccessibilityStates() { - var result = new AccessibilityStates {BitMask = Interop.ControlDevel.DaliToolkitDevelControlGetAccessibilityStates(SwigCPtr)}; + var result = new AccessibilityStates { BitMask = Interop.ControlDevel.DaliToolkitDevelControlGetAccessibilityStates(SwigCPtr) }; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return result; } @@ -353,7 +353,7 @@ namespace Tizen.NUI.BaseComponents { get { - return new AccessibilityEvents {Owner = this}; + return new AccessibilityEvents { Owner = this }; } } @@ -388,6 +388,40 @@ namespace Tizen.NUI.BaseComponents } [EditorBrowsable(EditorBrowsableState.Never)] + protected override void Dispose(bool disposing) + { + if (disposed) + { + return; + } + + internalName = null; + + if (SwigCPtr.Handle != IntPtr.Zero && global::System.Threading.Thread.CurrentThread.ManagedThreadId == Registry.Instance.SavedApplicationThread.ManagedThreadId) + { + Interop.ControlDevel.DaliAccessibilityDetachAccessibleObject(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + if (disposing == false) + { + if (IsNativeHandleInvalid() || SwigCMemOwn == false) + { + // at this case, implicit nor explicit dispose is not required. No native object is made. + disposed = true; + return; + } + } + + if (disposing) + { + Unparent(); + } + + base.Dispose(disposing); + } + + [EditorBrowsable(EditorBrowsableState.Never)] protected static readonly string AccessibilityActivateAction = "activate"; [EditorBrowsable(EditorBrowsableState.Never)] protected static readonly string AccessibilityReadingSkippedAction = "ReadingSkipped"; diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs index f37ef41..5e9a007 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs @@ -1346,12 +1346,6 @@ namespace Tizen.NUI.BaseComponents disposeDebugging(type); - internalName = ""; - Unparent(); - - Interop.ControlDevel.DaliAccessibilityDetachAccessibleObject(SwigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - //_mergedStyle = null; internalMaximumSize?.Dispose(); -- 2.7.4