• Lau Ching Jun's avatar
    Fixed race condition in PollingDeviceDiscovery. (#145506) · c759c22e
    Lau Ching Jun authored
    There are two issues in the previous implementation:
    1. `_populateDevices` will return the devices from `deviceNotifier` if it had been initialized, assuming that once it's initialized, it has been properly populated. That assumption is not true because calling getters like `onAdded` would initialize `deviceNotifier` without populating it.
    2. `deviceNotifier` instance might be replaced in some cases, causing `onAdded` subscribers to lose any future updates.
    
    To fix (1), this commit added the `isPopulated` field in `deviceNotifier` as a more accurate flag to determine if we need to populate it.
    
    To fix (2), this commit made `deviceNotifier` a final member in `PolingDeviceDiscovery`.
    c759c22e
Name
Last commit
Last update
..
android_preview_integration.shard Loading commit data...
commands.shard Loading commit data...
data Loading commit data...
general.shard Loading commit data...
host_cross_arch.shard Loading commit data...
integration.shard Loading commit data...
src Loading commit data...
web.shard Loading commit data...