fix: DCHECK on print job cancellation (#25031)

This commit is contained in:
Shelley Vohr 2020-08-19 23:28:24 -07:00 committed by GitHub
parent 53668445ba
commit 9631eafa1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,7 +90,7 @@ index 977ad787270844b218a87fbe04fea616619e84ba..592fe4459cdae22d23a933a31c452c44
} }
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
index 2917e93c3f22b3bcbe683c2b944c7af25e66f950..2cdfd7cec04c979aa8ca77273f9816495cdf147a 100644 index 2917e93c3f22b3bcbe683c2b944c7af25e66f950..33f48f473efd04e165ec7b9a8738b8d7c18a6adc 100644
--- a/chrome/browser/printing/print_view_manager_base.cc --- a/chrome/browser/printing/print_view_manager_base.cc
+++ b/chrome/browser/printing/print_view_manager_base.cc +++ b/chrome/browser/printing/print_view_manager_base.cc
@@ -27,10 +27,7 @@ @@ -27,10 +27,7 @@
@ -249,6 +249,9 @@ index 2917e93c3f22b3bcbe683c2b944c7af25e66f950..2cdfd7cec04c979aa8ca77273f981649
printing_rfh_ = nullptr; printing_rfh_ = nullptr;
+ if (!callback_.is_null()) { + if (!callback_.is_null()) {
+ registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
+ content::NotificationService::AllSources());
+
+ std::string cb_str = ""; + std::string cb_str = "";
+ if (!printing_succeeded_) + if (!printing_succeeded_)
+ cb_str = printing_cancelled_ ? "cancelled" : "failed"; + cb_str = printing_cancelled_ ? "cancelled" : "failed";
@ -263,9 +266,6 @@ index 2917e93c3f22b3bcbe683c2b944c7af25e66f950..2cdfd7cec04c979aa8ca77273f981649
- registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, - registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
- content::Source<PrintJob>(print_job_.get())); - content::Source<PrintJob>(print_job_.get()));
+ if (!callback_.is_null())
+ registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
+ content::NotificationService::AllSources());
// Don't close the worker thread. // Don't close the worker thread.
print_job_ = nullptr; print_job_ = nullptr;
} }