-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
[Peripherals] Fix segfault by adding some synchronization to peripheral add-ons #11824
Conversation
The command to power off controllers should be called from inside an exit callback. This callback is issued before shutdown begins, so power-off no longer depends on systems that have already been deinitialized.
I've pushed a new commit and updated the PR description. It turns out, there were only 2 segfaults at work here, one from misbehaving peripheral add-ons, and one due to g_peripherals being a static variable and trying to release resources that had already disappeared. |
Does this also affect v17? |
Yes, Kodi is still crashing on the Steam Link, so without this Kodi crashes on exit 100% of the time. |
This almost concludes my Krypton backports. The only other bugs I care to fix are the iMON incompatibility and better Shield controller support. If we're gearing up for 17.1 release I'm fine waiting for 17.2 or 18.0. |
Hold off on merging. The shutdown stuff still isn't happening in the right order. |
825607b
to
c4a8867
Compare
lol, peripherals shutdown was 1 line off. Also pushed a commit for a third segfault that arose from starting/stopping things in the proper order. jenkins build this please |
jenkins build this please |
xbmc/games/ports/PortMapper.cpp
Outdated
{ | ||
assert(m_peripheralManager != nullptr); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
updated with @thebrid's comment. jenkins build this please |
Build errors look unrelated, but both OSX and linux64 failed, so again we try. Jenkins build this please. |
let's try again. jenkins build and merge |
jenkins build this please |
There's an error with the test cases. Moving around the order of services on startup typically breaks things. I'll address this when I get a chance. Until then, this problem only manifests with broken peripheral add-ons, which is only peripheral.joystick on the Steam Link (and I work around it). So not critical. |
test cases fixed! jenkins build this please |
This fixes a segfault at exit when peripheral add-ons misbehave. In particular, if the add-on hangs in another thread, then it can be destroyed while still in use. This was causing a segfault on exit.
Another segfault (or possibly the same one) has been fixed by moving g_peripherals to ServiceManager. Before, it tried to release resources when the static object was deconstructed after the app shut down.
Types of change