[NUI] Make DaliAccessibilityDetachAccessibleObject called at main thread
authorEunki, Hong <eunkiki.hong@samsung.com>
Mon, 30 Oct 2023 04:49:51 +0000 (13:49 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Mon, 30 Oct 2023 12:38:47 +0000 (21:38 +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 a4447f2adb973821e45e3762d7d6b64fe35f4b81..f5e80e4c94fab7898696dc50e563e335425dddf3 100755 (executable)
@@ -103,6 +103,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 5dead2509432b401c6ef09875070673b82a05cad..674586b77742d450d2fa7f0d231c3123a4413b3c 100755 (executable)
@@ -387,37 +387,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 93cded688a07fffc412a67c91d729b6c239c3320..f37ef41cfa9a018c7460f482f221c58bd88e760d 100755 (executable)
@@ -1346,6 +1346,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();
@@ -1388,7 +1394,6 @@ namespace Tizen.NUI.BaseComponents
             rotationGestureDetector?.Dispose();
             rotationGestureDetector = null;
 
-
             internalCurrentParentOrigin?.Dispose();
             internalCurrentParentOrigin = null;
             internalCurrentAnchorPoint?.Dispose();