• tzik's avatar
    Avoid touching dbus::ObjectManager ref count before it's fully cosntructed · 570f47a2
    tzik authored
    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: default avatarRyo Hashimoto <hashimoto@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#577465}
    570f47a2
bus.cc 37.9 KB