[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 20ffb89..bf94e9f 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 41dbd50..f2560bc 100755 (executable)
@@ -368,37 +368,6 @@ namespace Tizen.NUI.BaseComponents
         }
 
         [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)]
         protected static readonly string AccessibilityReadingSkippedAction = "ReadingSkipped";
index beca5f6..36446f4 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();