Android: Fix for accessibility potential crash

When accessibility was not active it was possible to force its
update, causing a null pointer exception in java.

Change-Id: I60f65612d6e9f712ba3c591ffcc6803f06f09efb
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit fe51137f859948472571ce4c879955eb74c77716)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Piotr Mikolajczyk 2020-12-17 09:40:48 +01:00 committed by Qt Cherry-pick Bot
parent 6341e89e28
commit 9ed54aadc2
2 changed files with 3 additions and 1 deletions

View File

@ -203,6 +203,8 @@ public class QtAccessibilityDelegate extends View.AccessibilityDelegate
public void notifyObjectFocus(int viewId)
{
if (m_view == null)
return;
m_view.invalidate();
sendEventForVirtualViewId(viewId,
AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED);

View File

@ -52,7 +52,7 @@ QAndroidPlatformAccessibility::~QAndroidPlatformAccessibility()
void QAndroidPlatformAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
{
if (event == nullptr || !event->accessibleInterface())
if (!isActive() || event == nullptr || !event->accessibleInterface())
return;
// We do not need implementation of all events, as current statues are polled