[NUI] DetachAccessibleObject at Dispose time well
authorEunki, Hong <eunkiki.hong@samsung.com>
Fri, 10 Nov 2023 07:53:52 +0000 (16:53 +0900)
committerJaehyun Cho <jaehyun0cho@gmail.com>
Wed, 15 Nov 2023 08:56:46 +0000 (17:56 +0900)
There was several problem when we call DaliAccessibilityDetachAccessibleObject
at Dispose(bool) function

 - It will detach accessibility even if view doesn't owned the handle memory
 - Dispose(bool) can be called at worker thread (during GC) so we need to check thread here

I make to DaliAccessibilityDetachAccessibleObject function at Dispose(DisposeTypes)
that we can ensure it called at main thread clearly.

Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs
src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs

index 0b9ee80..eabb666 100755 (executable)
@@ -397,12 +397,6 @@ namespace Tizen.NUI.BaseComponents
 
             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)
index 5e9a007..9e68a77 100755 (executable)
@@ -1346,6 +1346,12 @@ namespace Tizen.NUI.BaseComponents
 
             disposeDebugging(type);
 
+            if (SwigCMemOwn && !IsNativeHandleInvalid())
+            {
+                Interop.ControlDevel.DaliAccessibilityDetachAccessibleObject(SwigCPtr);
+                NDalicPINVOKE.ThrowExceptionIfExists();
+            }
+
             //_mergedStyle = null;
 
             internalMaximumSize?.Dispose();