Skip to content

Commit

Permalink
Retain ref-count of a bound ref-counted object in //printing
Browse files Browse the repository at this point in the history
|data| at PrintedDocument::DebugDumpData argument is a ref-counted type,
and an explicit lifetime management is needed on base::Bind.

This pattern of raw pointers to a ref-counted object should be checked
in base::Bind implementation, but it has failed to ban the pattern when
the pointee was const.

Bug: 737010
Change-Id: Icf0b08418e6fcda2b88c61db32c25d88703362cf
Reviewed-on: https://chromium-review.googlesource.com/551437
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#483076}
  • Loading branch information
tzik authored and Commit Bot committed Jun 28, 2017
1 parent 5e9ff60 commit df97f3d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions printing/printed_document.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,10 @@ void PrintedDocument::DebugDumpData(
const base::FilePath::StringType& extension) {
if (g_debug_dump_info.Get().empty())
return;
base::PostTaskWithTraits(
FROM_HERE, {base::TaskPriority::BACKGROUND, base::MayBlock()},
base::BindOnce(&DebugDumpDataTask, name(), extension, data));
base::PostTaskWithTraits(FROM_HERE,
{base::TaskPriority::BACKGROUND, base::MayBlock()},
base::BindOnce(&DebugDumpDataTask, name(), extension,
base::RetainedRef(data)));
}

PrintedDocument::Mutable::Mutable(PrintedPagesSource* source)
Expand Down

0 comments on commit df97f3d

Please sign in to comment.