diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-30 20:20:04 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-30 20:20:04 +0000 |
commit | d5a1e0e9b333dab910164c0063194437cae554a3 (patch) | |
tree | 7f1792441f926142ae96c4648c94256a511a0ef0 /chrome/browser/printing | |
parent | 91cef2b412f8c4c738c90bbeb874c40e0e2337a4 (diff) | |
download | chromium_src-d5a1e0e9b333dab910164c0063194437cae554a3.zip chromium_src-d5a1e0e9b333dab910164c0063194437cae554a3.tar.gz chromium_src-d5a1e0e9b333dab910164c0063194437cae554a3.tar.bz2 |
Print Preview: Speculative fix for a crash.
BUG=87029
TEST=none
Review URL: http://codereview.chromium.org/7248054
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91188 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing')
-rw-r--r-- | chrome/browser/printing/background_printing_manager.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/chrome/browser/printing/background_printing_manager.cc b/chrome/browser/printing/background_printing_manager.cc index dbe5264..3a4b32e 100644 --- a/chrome/browser/printing/background_printing_manager.cc +++ b/chrome/browser/printing/background_printing_manager.cc @@ -66,19 +66,24 @@ void BackgroundPrintingManager::Observe(NotificationType type, const NotificationDetails& details) { switch (type.value) { case NotificationType::PRINT_JOB_RELEASED: { + TabContentsWrapper* tab = Source<TabContentsWrapper>(source).ptr(); + registrar_.Remove(this, NotificationType::PRINT_JOB_RELEASED, + Source<TabContentsWrapper>(tab)); + // 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<TabContentsWrapper>(source).ptr()); + MessageLoop::current()->DeleteSoon(FROM_HERE, tab); break; } case NotificationType::TAB_CONTENTS_DESTROYED: { TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( Source<TabContents>(source).ptr()); - registrar_.Remove(this, NotificationType::PRINT_JOB_RELEASED, - Source<TabContentsWrapper>(tab)); + if (registrar_.IsRegistered(this, NotificationType::PRINT_JOB_RELEASED, + Source<TabContentsWrapper>(tab))) { + registrar_.Remove(this, NotificationType::PRINT_JOB_RELEASED, + Source<TabContentsWrapper>(tab)); + } registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, Source<TabContents>(tab->tab_contents())); printing_contents_.erase(tab); |