summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authorfinnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-26 18:42:23 +0000
committerfinnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-26 18:42:23 +0000
commitd53b4ad91e57d3cf64c3188a89843242c75347aa (patch)
treeb0d3a2e63ad68720734e6a7ec7a1f5089be6abf6 /chrome/browser/views
parent5ae566d6f57c8c0071dad41dcd76b21a6dabe5ff (diff)
downloadchromium_src-d53b4ad91e57d3cf64c3188a89843242c75347aa.zip
chromium_src-d53b4ad91e57d3cf64c3188a89843242c75347aa.tar.gz
chromium_src-d53b4ad91e57d3cf64c3188a89843242c75347aa.tar.bz2
Fixing crash in StartFinding (2nd attempt).
The first attempt to fix this was unsuccessful and crashes showed up again during the automated ui testing. I still can't reproduce locally, but when I look again at the crash dump I think that the fact that it looked like the FindBarView was destroyed is misleading and the real issue is the same as with the crash in StopFinding (that web_contents has been destroyed moments before we receive the request). I am therefore removing the code I added earlier and replacing it with a null check for web_contents. TEST=Covered by automated ui tests. BUG=8048 Review URL: http://codereview.chromium.org/27219 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10489 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/find_bar_view.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/chrome/browser/views/find_bar_view.cc b/chrome/browser/views/find_bar_view.cc
index ce507e3..aa59cf9 100644
--- a/chrome/browser/views/find_bar_view.cc
+++ b/chrome/browser/views/find_bar_view.cc
@@ -168,10 +168,6 @@ FindBarView::FindBarView(FindBarWin* container)
}
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::ButtonPressed(views::BaseButton* sender) {
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).