Skip to content

Commit

Permalink
[NUI][AT-SPI] Detach NUIViewAccessible in View.Dispose()
Browse files Browse the repository at this point in the history
The application may crash if the View is disposed but the Accessibility
infrastructure calls one of the View methods. Detaching the
NUIViewAccessible proxy object in View.Dispose() should prevent that.
  • Loading branch information
Artur Świgoń committed Oct 19, 2023
1 parent 9ee2950 commit d51fb4c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Tizen.NUI/src/internal/Interop/Interop.ControlDevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,9 @@ private AccessibilityDelegate()

[DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_SetAccessibilityDelegate")]
public static extern IntPtr DaliAccessibilitySetAccessibilityDelegate(IntPtr arg1_accessibilityDelegate, uint arg2_accessibilityDelegateSize);

[DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_DetachAccessibleObject")]
public static extern void DaliAccessibilityDetachAccessibleObject(HandleRef arg1_control);
}
}
}
3 changes: 3 additions & 0 deletions src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,9 @@ protected override void Dispose(bool disposing)

internalName = null;

Interop.ControlDevel.DaliAccessibilityDetachAccessibleObject(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();

if (disposing == false)
{
if (IsNativeHandleInvalid() || SwigCMemOwn == false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ private static void InitializeAccessibilityDelegateAccessibleInterface()
private static ulong AccessibilityCalculateStatesWrapper(IntPtr self, ulong initialStates)
{
View view = GetViewFromRefObject(self);
if (view == null)
return 0UL;

ulong bitMask = 0UL;

Expand Down

0 comments on commit d51fb4c

Please sign in to comment.