Avoid touching ChainedBlobWriterImpl's ref count before it's fully constructed
ChainedBlobWriterImpl is a ref-counted object, and its first reference used to be taken by base::BindOnce implicitly in its constructor. The reference is posted to another thread, and released after the task has run. However, if the task finished before the constructor finished, the object is destroyed immediately, and `new ChainedBlobWriterImpl` may return a stale pointer. This CL adds a static constructor to ChainedBlobWriterImpl to keep a reference while the task is posted. Bug: 866456 Change-Id: If8fee2e8944ce550e766b5269d47878f357db6c5 Reviewed-on: https://chromium-review.googlesource.com/1148098Reviewed-by:Daniel Murphy <dmurph@chromium.org> Commit-Queue: Taiju Tsuiki <tzik@chromium.org> Cr-Commit-Position: refs/heads/master@{#577638}
Showing
Please register or sign in to comment