From c978622b9e166d899d5968af61deef58d6fdd3bc 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 --- .../public/BaseComponents/LottieAnimationView.cs | 1 + .../src/public/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 a4447f2..f5e80e4 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs @@ -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); } diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs index 5dead25..674586b 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs @@ -388,37 +388,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"; diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs index 93cded6..f37ef41 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs @@ -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(); -- 2.7.4