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

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 1357883002: Mac: Fix a crash in TextInputClientMac::GetFirstRectForRange() likely during tab closure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cancelComposition, test Created 5 years, 3 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 | content/browser/renderer_host/render_widget_host_view_mac_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index ae60c419160f071682dfd6ea0bc1565eef2ad0bb..e94cf18559d800047ae5d0408f3e92858c42f682 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -2957,6 +2957,13 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
- (NSRect)firstRectForCharacterRange:(NSRange)theRange
actualRange:(NSRangePointer)actualRange {
+ // During tab closure, events can arrive after RenderWidgetHostViewMac::
+ // Destroy() is called, which will have set |render_widget_host_| to null.
+ if (!renderWidgetHostView_->render_widget_host_) {
+ [self cancelComposition];
+ return NSZeroRect;
+ }
+
NSRect rect = [self firstViewRectForCharacterRange:theRange
actualRange:actualRange];
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698