[NUI] Make DaliAccessibilityDetachAccessibleObject called at main thread
authorEunki, Hong <eunkiki.hong@samsung.com>
Mon, 30 Oct 2023 04:49:51 +0000 (13:49 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 2 Nov 2023 08:07:53 +0000 (17:07 +0900)
void Dispose(bool) can be called from worker thread, when disposing value is false.

To ensure we detach AccessibileObject in main thread, let we remove it
at Dispose(DisposeTypes), instead of Dispose(bool).

To avoid this kind of error in future, let we remove View.Dispose(bool)
and let we only use Dispose(DisposeTypes).

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

index 20ffb89dc4b34a49de14d7219cd17c682f3be548..bf94e9fbe2cb75a5fa12ba7cb7c0fee2867c12c2 100755 (executable)
@@ -102,6 +102,7 @@ namespace Tizen.NUI.BaseComponents
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected override void Dispose(bool disposing)
         {
+            // Note : We can clean dictionaries even this API called from GC Thread.
             CleanCallbackDictionaries();
             base.Dispose(disposing);
         }
index 41dbd50850dedd95652949e0fe710ab7e1cf0fbf..f2560bcc043f052f4a9c0b8f3805483c0a7fc625 100755 (executable)
@@ -367,37 +367,6 @@ namespace Tizen.NUI.BaseComponents
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected override void Dispose(bool disposing)
-        {
-            if (disposed)
-            {
-                return;
-            }
-
-            internalName = null;
-
-            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)]
index beca5f6d5550be889a21519e5e397a17fdafcd60..36446f48f10e8a2fcaaac371aa48b85af0cfb868 100755 (executable)
@@ -1231,6 +1231,12 @@ namespace Tizen.NUI.BaseComponents
 
             disposeDebugging(type);
 
+            internalName = "";
+            Unparent();
+
+            Interop.ControlDevel.DaliAccessibilityDetachAccessibleObject(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
             //_mergedStyle = null;
 
             internalMaximumSize?.Dispose();
@@ -1273,7 +1279,6 @@ namespace Tizen.NUI.BaseComponents
             rotationGestureDetector?.Dispose();
             rotationGestureDetector = null;
 
-
             internalCurrentParentOrigin?.Dispose();
             internalCurrentParentOrigin = null;
             internalCurrentAnchorPoint?.Dispose();