Skip to content
Snippets Groups Projects
  • Chih-Yu Huang's avatar
    5e994b90
    components: pass weak_ptr to Component::Listener · 5e994b90
    Chih-Yu Huang authored
    After the component is destroyed, we cannot use shared_from_this()
    because there must be a valid shared_ptr pointing to the component.
    
    This CL changes to use weak_from_this() to get weak_ptr, and locks the
    weak_ptr when we need shared_ptr. Also, the parameter of
    Component::Listener's methods is weak_ptr, instead of shared_ptr.
    This CL also changes to pass weak_ptr to the listener.
    
    Bug: 198215986
    Test: android.media.cts.VideoEncoderTest#testOtherH264SurfArbitraryH
    Change-Id: I3bae943f211db5f68e3b9a86bc193eee09cba65e
    5e994b90
    History
    components: pass weak_ptr to Component::Listener
    Chih-Yu Huang authored
    After the component is destroyed, we cannot use shared_from_this()
    because there must be a valid shared_ptr pointing to the component.
    
    This CL changes to use weak_from_this() to get weak_ptr, and locks the
    weak_ptr when we need shared_ptr. Also, the parameter of
    Component::Listener's methods is weak_ptr, instead of shared_ptr.
    This CL also changes to pass weak_ptr to the listener.
    
    Bug: 198215986
    Test: android.media.cts.VideoEncoderTest#testOtherH264SurfArbitraryH
    Change-Id: I3bae943f211db5f68e3b9a86bc193eee09cba65e