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

Fix possible crash at exit on iOS #11781

Merged
merged 1 commit into from
Oct 9, 2017

Conversation

marcelofg55
Copy link
Contributor

Fixes the crash described at #11623 which happens when the iOS app tries to quit and the render callback keeps getting called (because AudioDriverIphone::finish wasn't clearing the property).

@27thLiz 27thLiz added this to the 2.1 milestone Oct 2, 2017
@marcelofg55 marcelofg55 force-pushed the iphone_crashfix branch 2 times, most recently from 61c2194 to 7201a14 Compare October 2, 2017 15:01
@marcelofg55 marcelofg55 changed the title Fix possible crash at exit on iOS [WIP] Fix possible crash at exit on iOS Oct 3, 2017
@marcelofg55 marcelofg55 changed the title [WIP] Fix possible crash at exit on iOS Fix possible crash at exit on iOS Oct 3, 2017
@@ -726,7 +726,8 @@ void AudioServerSW::_thread_func(void *self) {

while (!as->exit_update_thread) {
as->_update_streams(true);
OS::get_singleton()->delay_usec(5000);
if (OS::get_singleton())
OS::get_singleton()->delay_usec(5000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks a little suspect. We just sleep in hopes of avoiding a race?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sleeps a little to avoid calling _update_streams all the time and eat a lot of cpu.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could change this if (OS::get_singleton()) for an ERR_BREAK.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it isn't to avoid a race I guess this is OK, but how do we know this is the right amount of time to wait? Can't we have some kind of callback?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We process the audio in its own thread, which I think its great we take advantage of multiple cores and also avoid taking process time from the main thread, so a callback would be a bad idea in my opinion. And the timer has been like this for a long time I think so I don't want to mess with it, and 5ms if fine in my opinion.

@akien-mga akien-mga merged commit 87afd18 into godotengine:2.1 Oct 9, 2017
@marcelofg55 marcelofg55 deleted the iphone_crashfix branch October 17, 2017 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants