| Summary: | AX: Fix thread safety issue in AXIsolatedTree::setSelectedTextMarkerRange | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Joshua Hoffman <jhoffman23> | ||||||
| Component: | Accessibility | Assignee: | Joshua Hoffman <jhoffman23> | ||||||
| Status: | RESOLVED FIXED | ||||||||
| Severity: | Normal | CC: | aboxhall, andresg_22, apinheiro, cfleizach, dmazzoni, ews-watchlist, jcraig, samuel_white, webkit-bug-importer | ||||||
| Priority: | P2 | Keywords: | InRadar | ||||||
| Version: | WebKit Nightly Build | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Attachments: |
|
||||||||
|
Description
Joshua Hoffman
2023-11-01 10:26:09 PDT
Created attachment 468448 [details]
Patch
(In reply to Joshua Hoffman from comment #2) > Created attachment 468448 [details] > Patch diff --git a/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp b/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp index 057f683c009d..e2d551382ff4 100644 --- a/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp +++ b/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp @@ -910,6 +910,24 @@ void AXIsolatedTree::setFocusedNodeID(AXID axID) m_pendingFocusedNodeID = axID; } +AXTextMarkerRange AXIsolatedTree::selectedTextMarkerRange() +{ + AXTRACE("AXIsolatedTree::selectedTextMarkerRange"_s); + Locker locker { m_changeLogLock }; + return m_selectedTextMarkerRange; +} + AG: extra blank line. + +void AXIsolatedTree::setSelectedTextMarkerRange(AXTextMarkerRange range) +{ + AXTRACE("AXIsolatedTree::setSelectedTextMarkerRange"_s); + ASSERT(isMainThread()); + + Locker locker { m_changeLogLock }; + m_selectedTextMarkerRange = range; +} + AG: extra blank line. + void AXIsolatedTree::labelCreated(AccessibilityObject& axObject) { ASSERT(axObject.isLabel()); diff --git a/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h b/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h index ebc80fa48083..78b51ca89317 100644 --- a/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h +++ b/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h @@ -321,8 +321,8 @@ public: // Use only if the s_storeLock is already held like in findAXTree. WEBCORE_EXPORT OptionSet<ActivityState> lockedPageActivityState() const; - AXTextMarkerRange selectedTextMarkerRange() { return m_selectedTextMarkerRange; }; - void setSelectedTextMarkerRange(AXTextMarkerRange range) { m_selectedTextMarkerRange = range; } + AXTextMarkerRange selectedTextMarkerRange(); + void setSelectedTextMarkerRange(AXTextMarkerRange); AG: we should pass AXTextMarkerRange&& instead of by value. private: AXIsolatedTree(AXObjectCache&); AG: Add the macro WTF_GUARDED_BY_LOCK to the declaration: AXTextMarkerRange m_selectedTextMarkerRange; Created attachment 468452 [details]
Patch
Committed 270134@main (3e8a39cebd79): <https://commits.webkit.org/270134@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 468452 [details]. |