Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Games: Fix crash on game close after controller disconnects #14676

merged 1 commit into from Oct 24, 2018


Copy link

commented Oct 23, 2018

This fixes a crash that occurs when a controller is disconnected before gameplay ends, such as a wireless controller running out of batteries.

The crash occurs because CKeymapHandling unregisters itself with the peripheral object when destructed. However, if the peripheral was unplugged and the object deleted, then CKeymapHandling tries to unregister itself with the dangling pointer.

To fix this, we preemptively set CKeymapHandling:: m_inputProvider to null when we detect that the peripheral no longer exists. Then, on destruction, we can do a null check to avoid accessing a dangling pointer.

Motivation and Context

Batteries died... things went boom.

How Has This Been Tested?

Tested on OSX by yanking the batteries from my Xbox 360 controller. No more crash on game close.

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • None of the above (please explain below)

This comment has been minimized.

Copy link

commented Oct 23, 2018

Jenkins build this please


This comment has been minimized.

Copy link
Member Author

commented Oct 23, 2018

jenkins build this please

@garbear garbear merged commit 4cddccb into xbmc:master Oct 24, 2018

1 check passed

default You're awesome. Have a cookie

@garbear garbear deleted the garbear:fix-disconnect branch Oct 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.