diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-13 17:32:56 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-13 17:32:56 +0000 |
commit | 65132db90c1de8183e4ef0bb8add33167855812a (patch) | |
tree | 21f8b2050040f2bfec1851a852923633b8dd1be8 /chrome/browser/printing/background_printing_manager.cc | |
parent | 328105ba0bc7d658cf59debb08139fcc66ed1a85 (diff) | |
download | chromium_src-65132db90c1de8183e4ef0bb8add33167855812a.zip chromium_src-65132db90c1de8183e4ef0bb8add33167855812a.tar.gz chromium_src-65132db90c1de8183e4ef0bb8add33167855812a.tar.bz2 |
Merge 88582 - Attempt at fixing crash. It looks like the printing code can delete
the TabContents, not the TabContentsWrapper, which leaves the
TabContentsWrapper (and its associated helper classes) with references
to a deleted TabContents.
BUG=85455
TEST=none
R=thestig@chromium.org
Review URL: http://codereview.chromium.org/7104074
TBR=sky@chromium.org
Review URL: http://codereview.chromium.org/7046111
git-svn-id: svn://svn.chromium.org/chrome/branches/782/src@88840 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing/background_printing_manager.cc')
-rw-r--r-- | chrome/browser/printing/background_printing_manager.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/chrome/browser/printing/background_printing_manager.cc b/chrome/browser/printing/background_printing_manager.cc index 997fab7..e36e811 100644 --- a/chrome/browser/printing/background_printing_manager.cc +++ b/chrome/browser/printing/background_printing_manager.cc @@ -36,7 +36,7 @@ void BackgroundPrintingManager::OwnTabContents(TabContentsWrapper* contents) { printing_contents_.insert(contents); registrar_.Add(this, NotificationType::PRINT_JOB_RELEASED, - Source<TabContents>(contents->tab_contents())); + Source<TabContentsWrapper>(contents)); registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, Source<TabContents>(contents->tab_contents())); @@ -65,18 +65,20 @@ void BackgroundPrintingManager::Observe(NotificationType type, case NotificationType::PRINT_JOB_RELEASED: { // This might be happening in the middle of a RenderViewGone() loop. // Deleting |contents| later so the RenderViewGone() loop can finish. - MessageLoop::current()->DeleteSoon(FROM_HERE, - Source<TabContents>(source).ptr()); + MessageLoop::current()->DeleteSoon( + FROM_HERE, + Source<TabContentsWrapper>(source).ptr()); break; } case NotificationType::TAB_CONTENTS_DESTROYED: { - TabContents* contents = Source<TabContents>(source).ptr(); + TabContentsWrapper* tab = + TabContentsWrapper::GetCurrentWrapperForContents( + Source<TabContents>(source).ptr()); registrar_.Remove(this, NotificationType::PRINT_JOB_RELEASED, - Source<TabContents>(contents)); + Source<TabContentsWrapper>(tab)); registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, - Source<TabContents>(contents)); - printing_contents_.erase( - TabContentsWrapper::GetCurrentWrapperForContents(contents)); + Source<TabContents>(tab->tab_contents())); + printing_contents_.erase(tab); break; } default: { |