Skip to content

Conversation

@kryksyh
Copy link
Contributor

@kryksyh kryksyh commented Oct 8, 2025

Qt's accessibility on macOS may crash if an accessible item with the ListItem role has no parent (e.g., after setAccessibleParent(nullptr), which triggers QAccessible::ParentChanged). Internals assume the parent is valid and dereference it (see qcocoaaccessibilityelement.mm:136)

Our implementation falls back to qApp->focusWindow() (AccessibilityController::parentIface()), so the parent is usually set, but when the app is inactive the crash could happen (e.g. during theme reloads or when inspected by Accessibility Inspector, or during the shutdown).

This PR reduces the chance of having no accessible parent during UI changes, minimizing these crashes.

  • I signed the CLA
  • The title of the PR describes the problem it addresses
  • Each commit's message describes its purpose and effects, and references the issue it resolves
  • If changes are extensive, there is a sequence of easily reviewable commits
  • The code in the PR follows the coding rules
  • There are no unnecessary changes
  • The code compiles and runs on my machine, preferably after each commit individually
  • I created a unit test or vtest to verify the changes I made (if applicable)

@kryksyh kryksyh self-assigned this Oct 8, 2025
@cbjeukendrup cbjeukendrup requested review from Eism and removed request for cbjeukendrup October 8, 2025 13:33
@kryksyh kryksyh force-pushed the fix_accessibility_crashes_on_macos branch 2 times, most recently from def4abb to 9fc9c81 Compare October 9, 2025 07:40
Qt's accessibility on macOS may crash if an accessible item with the ListItem role has no parent
(e.g., after setAccessibleParent(nullptr), which triggers QAccessible::ParentChanged).
Internals assume the parent is valid and dereference it (see qcocoaaccessibilityelement.mm:136)

Our implementation falls back to qApp->focusWindow() (AccessibilityController::parentIface()),
so the parent is usually set, but when the app is inactive the crash could happen
(e.g. during theme reloads or when inspected by Accessibility Inspector, or during the shutdown).

This PR reduces the chance of having no accessible parent during UI changes, minimizing these crashes.
@kryksyh kryksyh force-pushed the fix_accessibility_crashes_on_macos branch from 9fc9c81 to b053050 Compare October 9, 2025 08:48
@kryksyh kryksyh merged commit 2cd097b into musescore:master Oct 9, 2025
13 of 14 checks passed
@kryksyh kryksyh deleted the fix_accessibility_crashes_on_macos branch October 9, 2025 10:41
kryksyh added a commit to kryksyh/audacity that referenced this pull request Oct 9, 2025
grliszas14 pushed a commit to audacity/audacity that referenced this pull request Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants