mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Android: Fix a couple of accessibility-related crashes
These crashes could be seen in the DemoRunner when selecting items in nested PopupMenu windows.
This commit is contained in:
parent
61b26e4e35
commit
2b1745272e
5 changed files with 24 additions and 5 deletions
|
|
@ -3308,6 +3308,18 @@ AccessibilityHandler* Component::getAccessibilityHandler()
|
|||
|| accessibilityHandler->getTypeIndex() != std::type_index (typeid (*this)))
|
||||
{
|
||||
accessibilityHandler = createAccessibilityHandler();
|
||||
|
||||
// On Android, notifying that an element was created can cause the system to request
|
||||
// the accessibility node info for the new element. If we're not careful, this will lead
|
||||
// to recursive calls, as each time an element is created, new node info will be requested,
|
||||
// causing an element to be created, causing a new info request...
|
||||
// By assigning the accessibility handler before notifying the system that an element was
|
||||
// created, the if() predicate above should evaluate to false on recursive calls,
|
||||
// terminating the recursion.
|
||||
if (accessibilityHandler != nullptr)
|
||||
notifyAccessibilityEventInternal (*accessibilityHandler, InternalAccessibilityEvent::elementCreated);
|
||||
else
|
||||
jassertfalse; // createAccessibilityHandler must return non-null
|
||||
}
|
||||
|
||||
return accessibilityHandler.get();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue