From f2943e3d0ab99c4b3169169fdb82fc64cbec70b0 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Wed, 8 Nov 2023 22:26:12 +0900 Subject: [PATCH] (A11y) Create Accessible at Detach() only if we use it before. Detach() API called at Dispose() timing. So we don't need to re-create Accessible that timing if we never use Accessible item previously. This patch have dependency with below pathces : https://review.tizen.org/gerrit/c/platform/core/uifw/dali-toolkit/+/301106 Change-Id: I55b40951ec792c52c82b53e3746c2a876e52dbe3 Signed-off-by: Eunki, Hong --- dali-csharp-binder/common/nui-view-accessible.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/dali-csharp-binder/common/nui-view-accessible.cpp b/dali-csharp-binder/common/nui-view-accessible.cpp index 58e8d2b..af4d32d 100644 --- a/dali-csharp-binder/common/nui-view-accessible.cpp +++ b/dali-csharp-binder/common/nui-view-accessible.cpp @@ -738,12 +738,23 @@ SWIGEXPORT void SWIGSTDCALL CSharp_Dali_Accessibility_DetachAccessibleObject(Dal GUARD_ON_NULL_RET(arg1_control); try_catch(([&]() { - auto* actorAccessible = Dali::Accessibility::Accessible::Get(*arg1_control); - auto* viewAccessible = dynamic_cast(actorAccessible); - - if(viewAccessible) + Dali::Toolkit::Control control = *arg1_control; + if(DALI_LIKELY(control)) { - viewAccessible->Detach(); + // Call detach only if accessible was created before. + if(DevelControl::IsAccessibleCreated(control)) + { + auto* actorAccessible = Dali::Accessibility::Accessible::Get(control); + auto* viewAccessible = dynamic_cast(actorAccessible); + + if(viewAccessible) + { + viewAccessible->Detach(); + } + } + + // Make that we will not create new NUIViewAccessible anymore. + DevelControl::EnableCreateAccessible(control, false); } })); } -- 2.7.4