Avoid touching dbus::ObjectManager ref count before it's fully cosntructed
dbus::ObjectManager's reference count is zero at the beginning of its constructor, and used to be incremented at base::Bind there implicitly. However, if PostTaskAndReplyWithResult there failed, the reference is gone and the reference count gets to 0 again. And as the result, `new ObjectManager` may return a stale pointer. This CL adds a static constructor to ObjectManager, and moves the ref count manipulation part out from the constructor. Bug: 866456 Change-Id: I5dd8947a5087359005cbcb75e1bb2a0a42ebeda8 Reviewed-on: https://chromium-review.googlesource.com/1148037 Commit-Queue: Taiju Tsuiki <tzik@chromium.org> Reviewed-by:Ryo Hashimoto <hashimoto@chromium.org> Cr-Commit-Position: refs/heads/master@{#577465}
Showing
Please register or sign in to comment