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

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

Issue 17261008: Fix crash when system retains an accessibility object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
Index: content/browser/accessibility/browser_accessibility_mac.mm
diff --git a/content/browser/accessibility/browser_accessibility_mac.mm b/content/browser/accessibility/browser_accessibility_mac.mm
index 0725e913be5934ec5fc2f6e6365896b44091966b..11595a10e28b1838754f11b9be584899052ed8a8 100644
--- a/content/browser/accessibility/browser_accessibility_mac.mm
+++ b/content/browser/accessibility/browser_accessibility_mac.mm
@@ -37,17 +37,14 @@ void BrowserAccessibilityMac::PreInitialize() {
}
void BrowserAccessibilityMac::NativeReleaseReference() {
- if (browser_accessibility_cocoa_) {
- BrowserAccessibilityCocoa* temp = browser_accessibility_cocoa_;
- browser_accessibility_cocoa_ = nil;
- // Relinquish ownership of the cocoa obj.
- [temp release];
- // At this point, other processes may have a reference to
- // the cocoa object. When the retain count hits zero, it will
- // destroy us in dealloc.
- // For that reason, do *not* make any more calls here after
- // as we might have been deleted.
- }
+ // Detach this object from |browser_accessibility_cocoa_| so it
+ // no longer has a pointer to this object.
+ [browser_accessibility_cocoa_ detach];
+ // Now, release it - but at this point, other processes may have a
+ // reference to the cocoa object.
+ [browser_accessibility_cocoa_ release];
+ // Finally, it's safe to delete this since we've detached.
+ delete this;
}
bool BrowserAccessibilityMac::IsNative() const {

Powered by Google App Engine
This is Rietveld 408576698