1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Accessibility: Fixed a potential crash when re-using custom ListBox components

This commit is contained in:
ed 2021-05-12 16:44:38 +01:00
parent 972c45a76e
commit 64896eefcd

View file

@ -79,12 +79,7 @@ public:
row = newRow; row = newRow;
if (selectionHasChanged) if (selectionHasChanged)
{
isSelected = nowSelected; isSelected = nowSelected;
if (auto* handler = getAccessibilityHandler())
isSelected ? handler->grabFocus() : handler->giveAwayFocus();
}
} }
if (auto* m = owner.getModel()) if (auto* m = owner.getModel())
@ -102,6 +97,10 @@ public:
invalidateAccessibilityHandler(); invalidateAccessibilityHandler();
} }
} }
if (selectionHasChanged)
if (auto* handler = getAccessibilityHandler())
isSelected ? handler->grabFocus() : handler->giveAwayFocus();
} }
void performSelection (const MouseEvent& e, bool isMouseUp) void performSelection (const MouseEvent& e, bool isMouseUp)