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

Unified Diff: chrome/browser/views/find_bar_view.cc

Issue 27219: Fixing crash in StartFinding (2nd attempt).... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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: chrome/browser/views/find_bar_view.cc
===================================================================
--- chrome/browser/views/find_bar_view.cc (revision 10429)
+++ chrome/browser/views/find_bar_view.cc (working copy)
@@ -168,10 +168,6 @@
}
FindBarView::~FindBarView() {
- // We are going away so we don't want to be notified about further updates
- // to the text field. Otherwise, it can lead to crashes, as exposed by
- // automation testing in issue 8048.
- find_text_->SetController(NULL);
}
void FindBarView::SetFindText(const std::wstring& find_text) {
@@ -444,6 +440,12 @@
void FindBarView::ContentsChanged(views::TextField* sender,
const std::wstring& new_contents) {
+ // We must guard against a NULL web_contents, which can happen if the text
+ // in the Find box is changed right after the tab is destroyed. Otherwise, it
+ // can lead to crashes, as exposed by automation testing in issue 8048.
+ if (!container_->web_contents())
+ return;
+
// When the user changes something in the text box we check the contents and
// if the textbox contains something we set it as the new search string and
// initiate search (even though old searches might be in progress).
« 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