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

Unified Diff: chromeos/printing/ppd_provider.cc

Issue 2536933002: Fix segfault in PpdProvider (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/printing/ppd_provider.cc
diff --git a/chromeos/printing/ppd_provider.cc b/chromeos/printing/ppd_provider.cc
index 3d1071a42f201dc402e6205a5449bd4743dd09f2..80e7b00f24cbc0469b878423c9148b9ddfa9f315 100644
--- a/chromeos/printing/ppd_provider.cc
+++ b/chromeos/printing/ppd_provider.cc
@@ -85,10 +85,11 @@ class PpdProviderImpl : public PpdProvider {
<< "Can't have concurrent PpdProvider Resolve calls";
resolve_inflight_ = true;
auto cache_result = base::MakeUnique<base::Optional<base::FilePath>>();
+ auto* raw_cache_result_ptr = cache_result.get();
bool post_result = io_task_runner_->PostTaskAndReply(
FROM_HERE, base::Bind(&PpdProviderImpl::ResolveDoCacheLookup,
weak_factory_.GetWeakPtr(), ppd_reference,
- cache_result.get()),
+ raw_cache_result_ptr),
base::Bind(&PpdProviderImpl::ResolveCacheLookupDone,
weak_factory_.GetWeakPtr(), ppd_reference, cb,
std::move(cache_result)));
@@ -104,9 +105,10 @@ class PpdProviderImpl : public PpdProvider {
CHECK(!query_inflight_)
<< "Can't have concurrent PpdProvider QueryAvailable calls";
query_inflight_ = true;
+ auto* raw_cache_result_ptr = cache_result.get();
CHECK(io_task_runner_->PostTaskAndReply(
FROM_HERE, base::Bind(&PpdProviderImpl::QueryAvailableDoCacheLookup,
- weak_factory_.GetWeakPtr(), cache_result.get()),
+ weak_factory_.GetWeakPtr(), raw_cache_result_ptr),
base::Bind(&PpdProviderImpl::QueryAvailableCacheLookupDone,
weak_factory_.GetWeakPtr(), cb, std::move(cache_result))));
}
@@ -136,6 +138,7 @@ class PpdProviderImpl : public PpdProvider {
void QueryAvailableDoCacheLookup(
base::Optional<const PpdProvider::AvailablePrintersMap*>* cache_result)
const {
+ DCHECK(cache_result);
auto tmp = cache_->FindAvailablePrinters();
if (tmp != nullptr) {
*cache_result = tmp;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698