Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Unified Diff: content/browser/accessibility/browser_accessibility_cocoa.mm

Issue 2949833006: Mac a11y: Fix AXTextMarker leaks. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/accessibility/browser_accessibility_cocoa.mm
diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm
index f0d696d97b18e355b41e42b15f5a19d65f944754..2698d30c785d5b46b8259a9346cfe8147a84e49c 100644
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm
@@ -140,25 +140,24 @@ AXTextMarkerRef AXTextMarkerRangeCopyEndMarker(
} // extern "C"
-// to call |release| on it to transfer ownership of the position to the text
-// marker object.
+// AXTextMarkerCreate copies from data buffer given to it.
id CreateTextMarker(AXPlatformPositionInstance position) {
AXTextMarkerRef text_marker = AXTextMarkerCreate(
- kCFAllocatorDefault, reinterpret_cast<const UInt8*>(position.release()),
+ kCFAllocatorDefault, reinterpret_cast<const UInt8*>(position.get()),
sizeof(AXPlatformPosition));
return static_cast<id>(
base::mac::CFTypeRefToNSObjectAutorelease(text_marker));
}
-// |range| is destructed at the end of this method and ownership of its |anchor|
-// and |focus| are transfered to the marker range object.
+// |range| is destructed at the end of this method. |anchor| and |focus| are
+// copied into the individual text markers.
id CreateTextMarkerRange(const AXPlatformRange range) {
- AXTextMarkerRef start_marker = AXTextMarkerCreate(
+ base::ScopedCFTypeRef<AXTextMarkerRef> start_marker(AXTextMarkerCreate(
kCFAllocatorDefault, reinterpret_cast<const UInt8*>(range.anchor()),
- sizeof(AXPlatformPosition));
- AXTextMarkerRef end_marker = AXTextMarkerCreate(
+ sizeof(AXPlatformPosition)));
+ base::ScopedCFTypeRef<AXTextMarkerRef> end_marker(AXTextMarkerCreate(
kCFAllocatorDefault, reinterpret_cast<const UInt8*>(range.focus()),
- sizeof(AXPlatformPosition));
+ sizeof(AXPlatformPosition)));
AXTextMarkerRangeRef marker_range =
AXTextMarkerRangeCreate(kCFAllocatorDefault, start_marker, end_marker);
return static_cast<id>(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698