Fix joystick disconnect deadlocks

cherry-picks commit 59363d3d3f3fe9c1fe8f53ed4b3ca79f8fb6065d to resolve upstream bug #12825.

Merge request reports

Loading