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

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

Issue 27173: Fix 8030: Crash in EndFindSession (automation_ui_test) (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_win.cc
===================================================================
--- chrome/browser/views/find_bar_win.cc (revision 10325)
+++ chrome/browser/views/find_bar_win.cc (working copy)
@@ -196,15 +196,19 @@
animation_->Reset(1.0);
animation_->Hide();
- // When we hide the window, we need to notify the renderer that we are done
- // for now, so that we can abort the scoping effort and clear all the
- // tickmarks and highlighting.
- web_contents_->StopFinding(false); // false = don't clear selection on
- // page.
- view_->UpdateForResult(web_contents_->find_result(), std::wstring());
+ // |web_contents_| can be NULL for a number of reasons, for example when the
+ // tab is closing. We must guard against that case. See issue 8030.
+ if (web_contents_) {
+ // When we hide the window, we need to notify the renderer that we are done
+ // for now, so that we can abort the scoping effort and clear all the
+ // tickmarks and highlighting.
+ web_contents_->StopFinding(false); // false = don't clear selection on
+ // page.
+ view_->UpdateForResult(web_contents_->find_result(), std::wstring());
- // When we get dismissed we restore the focus to where it belongs.
- RestoreSavedFocus();
+ // When we get dismissed we restore the focus to where it belongs.
+ RestoreSavedFocus();
+ }
}
void FindBarWin::ChangeWebContents(WebContents* contents) {
@@ -280,8 +284,8 @@
const NotificationSource& source,
const NotificationDetails& details) {
if (type == NotificationType::FIND_RESULT_AVAILABLE) {
- // Don't update for notifications from TabContentses other than the one we are
- // actively tracking.
+ // Don't update for notifications from TabContentses other than the one we
+ // are actively tracking.
if (Source<TabContents>(source).ptr() == web_contents_) {
UpdateUIForFindResult(web_contents_->find_result(),
web_contents_->find_text());
« 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