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

IOS: Call exit(0) when exiting to prevent hanging #1836

Merged
merged 1 commit into from Sep 10, 2019

Conversation

@sluicebox
Copy link
Member

commented Sep 9, 2019

When quitting the ios7 backend, either through the launcher's Quit button or through a game's Quit function, the process always hangs instead of exiting. From the launcher I get a black screen, in the SCI games it hangs on the game frame. At that point I have to force kill the process.

I don't know why it isn't exiting cleanly, but the existing TODO comments suggests this wasn't quite finished. This has always happened to me on my non-jailbroken iphone se throughout its major ios versions. Seems like throwing an exit(0) at it is a good fix until the root cause is discovered, if it even matters. iOS7_main() finishes but UIApplicationMain() isn't returning, and there's no further code after that.

I have an iphone 4 running ios4 with the old 1.5 scummvm on it, and it exited cleanly, so I don't know if this problem was introduced with the ios7 backend or in a new ios version. (In my experience, probably the latter.)

IOS: Call exit(0) when exiting to prevent hanging
Prevents the process from hanging on exit when using the
Quit button in launcher or a game's quit function
@bluegr

This comment has been minimized.

Copy link
Member

commented Sep 9, 2019

@sluicebox

This comment has been minimized.

Copy link
Member Author

commented Sep 10, 2019

Uh oh... there goes our spot in the app store! =)

I'm familiar with Apple's position, but it's that ending the process at all is bad, and that's already what the ios version does and has always done. It's already doing what Apple doesn't want by returning from its entry point. Adding exit() just makes difference between that succeeding or failing, and it used to succeed. The ios port already calls exit() in other codepaths.

In other words, just having a Quit button makes Apple cry, but I don't know what to do about that, so it might as well work.

@Kawa-oneechan

This comment has been minimized.

Copy link
Contributor

commented Sep 10, 2019

I guess you'd just have to...

...Think Different™ 😎

@bluegr

This comment has been minimized.

Copy link
Member

commented Sep 10, 2019

Indeed, we are using exit() in other places in the IOS backend, and at the point where this is called (the end of the main endpoint), it's an expected call. Since this fixes the application hang, and it's a minimal change, it's OK to add it, till the situation is properly addressed in the future

@bluegr bluegr merged commit e8f009e into scummvm:master Sep 10, 2019

2 checks passed

Codacy/PR Quality Review Up to standards. A positive pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@sluicebox sluicebox deleted the sluicebox:ios7exit branch Sep 22, 2019

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