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

Unified Diff: chrome/service/cloud_print/printer_job_handler.cc

Issue 10079017: Fix a crash of GetPrinterCapsAndDefaults returns after the calling printer is deleted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | « chrome/service/cloud_print/printer_job_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/cloud_print/printer_job_handler.cc
diff --git a/chrome/service/cloud_print/printer_job_handler.cc b/chrome/service/cloud_print/printer_job_handler.cc
index b084c06bdf9da67c32a7f267b0c5bf07fc4c29ea..d7f562dacbe24a9d0e7b0affd4317f507ecaa642 100644
--- a/chrome/service/cloud_print/printer_job_handler.cc
+++ b/chrome/service/cloud_print/printer_job_handler.cc
@@ -54,7 +54,8 @@ PrinterJobHandler::PrinterJobHandler(
shutting_down_(false),
job_check_pending_(false),
printer_update_pending_(true),
- task_in_progress_(false) {
+ task_in_progress_(false),
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
}
bool PrinterJobHandler::Initialize() {
@@ -169,7 +170,7 @@ bool PrinterJobHandler::UpdatePrinterInfo() {
print_system_->GetPrinterCapsAndDefaults(
printer_info.printer_name.c_str(),
base::Bind(&PrinterJobHandler::OnReceivePrinterCaps,
- base::Unretained(this)));
+ weak_ptr_factory_.GetWeakPtr()));
// While we are waiting for the data, pretend we have work to do and return
// true.
« no previous file with comments | « chrome/service/cloud_print/printer_job_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698