Skip to content

Commit

Permalink
ax_ui: crash on getting unignored selection
Browse files Browse the repository at this point in the history
It's either MSAA caller does not have accessibility fully enabled, the case when a tree is not registered with a tree manager, or when a tree stays longer than it's registered with a tree manager. Assert in the former case to detect if this is a case. Return the selection as is in the latter case: the tree goes away and we cannot guarantee any data validity for it.

Regressed by crrev.com/c/3863567

(cherry picked from commit 68da7b4)

Change-Id: I83ca7b5144c81b78b16cdc7748d015a2a12fe984
Bug: 1371027
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3934862
Reviewed-by: Nektarios Paisios <nektar@chromium.org>
Commit-Queue: Nektarios Paisios <nektar@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1055870}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3937765
Reviewed-by: Krishna Govind <govind@chromium.org>
Commit-Queue: Prudhvikumar Bommana <pbommana@google.com>
Owners-Override: Prudhvikumar Bommana <pbommana@google.com>
Cr-Commit-Position: refs/branch-heads/5343@{#3}
Cr-Branched-From: d1a9027-refs/heads/main@{#1055528}
  • Loading branch information
asurkov authored and Chromium LUCI CQ committed Oct 6, 2022
1 parent 17b0344 commit 61cd781
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ui/accessibility/ax_selection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,11 @@ AXSelection::AXSelection(const AXTree& tree)
tree_id_(tree.GetAXTreeID()) {}

AXSelection& AXSelection::ToUnignoredSelection() {
DCHECK_NE(tree_id_, AXTreeIDUnknown())
<< "Tree is not registered with a tree manager";
const AXTreeManager* manager = AXTreeManager::FromID(tree_id_);
DCHECK(manager);
if (!manager)
return *this;

// If one of the selection endpoints is invalid, then the other endpoint
// should also be unset.
Expand Down

0 comments on commit 61cd781

Please sign in to comment.