• Victor Fei's avatar
    AXEventGenerator::PostProcess to remove empty event sets at end · 867d0031
    Victor Fei authored
    AXEventGenerator::Iterator iterates over the generated events in
    std::map<AXNode*, std::set<EventParams>> tree_events_. Often there
    could be entry with empty event sets (std::set<EventParams) in
    |tree_events_|, and if these empty event sets happen to be the first
    entry when we iterate over |tree_events_|, AXEventGenerator::Iterator
    ::operator++ would increment AXEventGenerator::Iterator::set_iter_
    past its end, causing an exception.
    
    This CL fixes this issue by looping over |tree_events_| in
    AXEventGenerator::PostprocessEvents a second time to delete empty
    empty std::set<EventParams> entry; so AXEventGenerator::Iterator
    should only iterate over non-empty std::set<EventParams> entry.
    DCHECKs are also added in AXEventGenerator::Iterator to check the
    condition that only non-empty event sets remain.
    
    AX-Relnotes: n/a
    
    Bug: 1120281
    
    Change-Id: I6c049be2cfb786c9777b4b840d598c77a8362e37
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2410925Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
    Commit-Queue: Victor Fei <vicfei@microsoft.com>
    Cr-Commit-Position: refs/heads/master@{#807115}
    867d0031
ax_event_generator.h 11.2 KB