Index: chrome/browser/tab_contents/thumbnail_generator.cc |
diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc |
index ab0d5f32358714e27951e0479291a16bfb2f6476..09ce31ac785b45f036c4a5c25e822216b662a5bf 100644 |
--- a/chrome/browser/tab_contents/thumbnail_generator.cc |
+++ b/chrome/browser/tab_contents/thumbnail_generator.cc |
@@ -483,8 +483,13 @@ SkBitmap ThumbnailGenerator::GetClippedBitmap(const SkBitmap& bitmap, |
void ThumbnailGenerator::UpdateThumbnailIfNecessary( |
WebContents* web_contents) { |
- // Skip if a pending entry exists. WidgetHidden can be called while navigaing |
- // pages and this is not a timing when thumbnails should be generated. |
+ // Destroying a WebContents may trigger it to be hidden, prompting a snapshot |
+ // which would be unwise to attempt <http://crbug.com/130097>. If the |
+ // WebContents is in the middle of destruction, do not risk it. |
+ if (web_contents->IsBeingDestroyed()) |
mazda
2012/08/30 17:19:18
How about the follwing code to deal with the case
Avi (use Gerrit)
2012/08/30 18:16:26
Is that in addition to this code or to replace it?
mazda
2012/08/30 19:39:22
I meant to replace it.
But when NOTIFICATION_TAB_C
Avi (use Gerrit)
2012/08/30 19:44:16
Adding a temporary dependency to TabContents would
mazda
2012/08/30 20:39:39
Yes, http://crbug.com/130097 was caused by NOTIFIC
|
+ return; |
+ // Skip if a pending entry exists. WidgetHidden can be called while navigating |
+ // pages and this is not a time when thumbnails should be generated. |
if (web_contents->GetController().GetPendingEntry()) |
return; |
const GURL& url = web_contents->GetURL(); |
@@ -501,7 +506,6 @@ void ThumbnailGenerator::UpdateThumbnailIfNecessary( |
void ThumbnailGenerator::UpdateThumbnail( |
WebContents* web_contents, const SkBitmap& thumbnail, |
const ClipResult& clip_result) { |
- |
Profile* profile = |
Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
history::TopSites* top_sites = profile->GetTopSites(); |