WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
260389
AX: Improve smart pointer usage in AXObjectCache
https://bugs.webkit.org/show_bug.cgi?id=260389
Summary
AX: Improve smart pointer usage in AXObjectCache
Joshua Hoffman
Reported
2023-08-18 09:14:13 PDT
Improve the usage of smart pointers in AXObjectCache
Attachments
Patch
(4.68 KB, patch)
2023-08-18 10:55 PDT
,
Joshua Hoffman
no flags
Details
Formatted Diff
Diff
Patch
(4.17 KB, patch)
2023-08-18 11:19 PDT
,
Joshua Hoffman
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2023-08-18 09:14:25 PDT
<
rdar://problem/114090467
>
Joshua Hoffman
Comment 2
2023-08-18 09:14:57 PDT
rdar://113803539
Joshua Hoffman
Comment 3
2023-08-18 10:55:26 PDT
Created
attachment 467328
[details]
Patch
Tyler Wilcock
Comment 4
2023-08-18 11:09:14 PDT
Comment on
attachment 467328
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=467328&action=review
> Source/WebCore/accessibility/AXObjectCache.cpp:2291 > + RefPtr protectedElement { element }; > + > if (nodeAndRendererAreValid(element) && rendererNeedsDeferredUpdate(*element->renderer())) { > - m_deferredAttributeChange.append({ element, attrName, oldValue, newValue }); > + m_deferredAttributeChange.append({ protectedElement, attrName, oldValue, newValue }); > if (!m_performCacheUpdateTimer.isActive()) > m_performCacheUpdateTimer.startOneShot(0_s); > AXLOG(makeString("Deferring handling of attribute ", attrName.localName().string(), " for element ", element->debugDescription())); > return; > } > - handleAttributeChange(element, attrName, oldValue, newValue); > + handleAttributeChange(protectedElement.get(), attrName, oldValue, newValue);
I don't think we need to protect this element with a RefPtr if !rendererNeedsDeferredUpdate(*element->renderer()) (because otherwise we append it to m_deferredAttributeChange which stores it as a WeakPtr). I think we only need to protect it if we're going to directly call handleAttributeChange with it.
Joshua Hoffman
Comment 5
2023-08-18 11:14:35 PDT
(In reply to Tyler Wilcock from
comment #4
)
> Comment on
attachment 467328
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=467328&action=review
> > > - handleAttributeChange(element, attrName, oldValue, newValue); > > + handleAttributeChange(protectedElement.get(), attrName, oldValue, newValue); > > I don't think we need to protect this element with a RefPtr if > !rendererNeedsDeferredUpdate(*element->renderer()) (because otherwise we > append it to m_deferredAttributeChange which stores it as a WeakPtr). I > think we only need to protect it if we're going to directly call > handleAttributeChange with it.
Gotcha—yeah that makes sense. I can move the refptr protection to before the handleAttributeChange call.
Joshua Hoffman
Comment 6
2023-08-18 11:19:09 PDT
Created
attachment 467330
[details]
Patch
EWS
Comment 7
2023-08-18 19:33:40 PDT
Committed
267064@main
(4e6fd1fb5461): <
https://commits.webkit.org/267064@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 467330
[details]
.
Andres Gonzalez
Comment 8
2023-08-21 07:20:34 PDT
(In reply to Joshua Hoffman from
comment #6
)
> Created
attachment 467330
[details]
> Patch
--- a/Source/WebCore/accessibility/AXObjectCache.cpp +++ b/Source/WebCore/accessibility/AXObjectCache.cpp @@ -2178,10 +2178,10 @@ void AXObjectCache::handleActiveDescendantChange(Element& element, const AtomStr } // Handle active-descendant changes when the target allows for it, or the controlled object allows for it. - AccessibilityObject* target = nullptr; + RefPtr<AccessibilityObject> target { nullptr }; The RefPtr default constructor initializes the pointer to nullptr so the initializer list is unnecessary here.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug