• Matt Reynolds's avatar
    Avoid overflowing the stack when disconnecting gamepads · 497bacb4
    Matt Reynolds authored
    On Mac, disconnecting an Xbox controller while a rumble effect
    is active may cause Chrome to recursively call
    AbstractHapticGamepad::Shutdown until the stack is exhausted.
    
    When shutting down a haptic gamepad with an ongoing vibration
    effect, Chrome calls SetZeroVibration to stop the effect before
    closing the connection to the gamepad. If the gamepad is no
    longer connected, this command will fail. In XboxDataFetcher on
    Mac, this failure triggers another call to Shutdown.
    
    To fix this, AbstractHapticGamepad::Shutdown will check for
    re-entry and abort if the gamepad is already shutting down.
    
    BUG=982902
    
    Change-Id: I9d2f4831810bb1a9f124ffecdfda83b4b322df92
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1705536Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
    Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#678358}
    497bacb4
abstract_haptic_gamepad.cc 6.37 KB