Avoid touching VEAEncoder's ref count before it's fully constructed
This contains a similar fix to the reverted previous attempt at http://crrev.com/556813c93fa177cd VEAEncoder is ref counted, and its first reference used to be retained in its constructor through base::Bind(). The reference is passed to the other sequence, and released when the callback instance is destroyed. If the PostTask there failed or the posted task ran soon, the VEAEncoder instance can be destroyed before another reference is retained on the original sequence. That is, `new VEAEncoder` may return a stale pointer. This CL adds a static cosntructor to VEAEncoder, and keeps the first reference before calling PostTask. Bug: 866456 Change-Id: Icbb430bebbfa5c800f3c0248b5afd10f2c2de271 Reviewed-on: https://chromium-review.googlesource.com/1158316Reviewed-by:Emircan Uysaler <emircan@chromium.org> Commit-Queue: Taiju Tsuiki <tzik@chromium.org> Cr-Commit-Position: refs/heads/master@{#580050}
Showing
Please register or sign in to comment