• Stephane Zermatten's avatar
    [Autofill Assistant] Cleanup some possibly unsafe pointers accesses. · 67943b2d
    Stephane Zermatten authored
    This change replaces base::Unretained with a weak ptr everywhere where
    there's possible a doubt that something could go wrong.
    
    In particular, it uses weak ptrs for the try_done and all_done callbacks
    of batch element checkers, since they can be called after the checker
    has been deleted, even if it's unlikely.
    
    This change also moves the script tracker in the Controller to make it
    the last owned type to be deleted, as the script tracker will access
    everything that exists in the controller, through actions. It's best to
    delete it first.
    
    Finally, this change adds null checks for ui_delegate_ in
    android_ui_controller.cc, as the controller can delete itself separate
    from any UI decisions. In this case, it sets ui_delegate_ to null.
    
    Bug: 806868
    Change-Id: Ie2e11ea54a1bdf80c4bc80d79a158a1658bc0d1b
    Reviewed-on: https://chromium-review.googlesource.com/c/1353942
    Commit-Queue: Stephane Zermatten <szermatt@chromium.org>
    Reviewed-by: default avatarGanggui Tang <gogerald@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#612264}
    67943b2d
ui_controller_android.h 6.59 KB