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

RetroPlayer: Fix segfault when loading game #14146

Merged
merged 3 commits into from
Jul 5, 2018

Conversation

garbear
Copy link
Member

@garbear garbear commented Jul 4, 2018

This fixes a segfault that occurs when connecting a controller before loading a game in some cores.

This is valid behavior according to the libretro API, however multiple cores fail to fully allocate input resources until after the game is loaded, leading to segfaults. To fix this, we just defer connecting controllers until after loading the game.

A second fix for a potential segfault (only observed while testing) is also included.

How Has This Been Tested?

Tested on OSX with Beetle-PSX

Types of change

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

The cause of the segfault is libretro cores that fail to allocate input
resources during initialization. Instead, input resources are allocated
when the game is loaded. To accomodate this, we move our controller
connecting/disconnecting to after the game is loaded.

This commit also corrects the order of init/deinit for other game add-on
resources.
This guards against an edge case where, in rare circumstances, an
audio/video stream could fail to open, causing a segfault.

Observed during testing, but not in production.
@garbear garbear added Type: Fix non-breaking change which fixes an issue v18 Leia Component: Games labels Jul 4, 2018
@garbear garbear added this to the Leia 18.0-alpha3 milestone Jul 4, 2018
@garbear
Copy link
Member Author

garbear commented Jul 5, 2018

jenkins build this please

@garbear garbear merged commit 03f2697 into xbmc:master Jul 5, 2018
@garbear garbear deleted the rp-fix-segfault branch July 5, 2018 22:30
KOPRajs added a commit to KOPRajs/xbmc that referenced this pull request Nov 21, 2018
nsenica pushed a commit to PIPplware/xbmc that referenced this pull request Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Games Type: Fix non-breaking change which fixes an issue v18 Leia
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant