From e49f916c16c571c65e80315588a75cbaea046783 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Mon, 30 Oct 2023 13:49:51 +0900 Subject: [PATCH] [NUI] Make DaliAccessibilityDetachAccessibleObject called at main thread 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 --- .../BaseComponents/LottieAnimationView.cs | 1 + .../BaseComponents/ViewAccessibility.cs | 31 ------------------- .../src/public/BaseComponents/ViewInternal.cs | 7 ++++- 3 files changed, 7 insertions(+), 32 deletions(-) diff --git a/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs b/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs index a4447f2adb9..f5e80e4c94f 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs @@ -103,6 +103,7 @@ protected override void Dispose(DisposeTypes type) [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); } diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs index 5dead250943..674586b7774 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs @@ -387,37 +387,6 @@ public void UnregisterDefaultLabel() 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)] diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs index 93cded688a0..f37ef41cfa9 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs @@ -1346,6 +1346,12 @@ protected override void Dispose(DisposeTypes type) disposeDebugging(type); + internalName = ""; + Unparent(); + + Interop.ControlDevel.DaliAccessibilityDetachAccessibleObject(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + //_mergedStyle = null; internalMaximumSize?.Dispose(); @@ -1388,7 +1394,6 @@ protected override void Dispose(DisposeTypes type) rotationGestureDetector?.Dispose(); rotationGestureDetector = null; - internalCurrentParentOrigin?.Dispose(); internalCurrentParentOrigin = null; internalCurrentAnchorPoint?.Dispose();