godot: Crash on exit iOS application when using iOS 13

iPhone 5( 32bit) - Godot version: 2.1.2

Crash on exit application in godot/servers/audio/audio_server_sw.cpp on line 774:

void AudioServerSW::_thread_func(void *self) {

	Thread::set_name("AudioServerSW");

	AudioServerSW *as=(AudioServerSW *)self;

	while (!as->exit_update_thread) {
		as->_update_streams(true);
		OS::get_singleton()->delay_usec(5000); <<--  Crash here
	}

}

Resume: OS::get_singleton() – not thread save (maybe do “delay_usec” as static) and not correct finalize class. In my case OS::get_singleton() === NULL.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 28 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Follow #32194 remove [self drawView] in layoutSubviews and re-compile can fix crashes when switching to the background (press Home button), but it still crashes when closing in the app switcher.

Use one of the later betas: I’m using 3.2b3 and it works fine. Avoid 3.2b1-2 as performance was much worse then. The betas are useful as they come with precompiled templates.

On Mon, 30 Dec 2019, 05:22 jeudy-ua, notifications@github.com wrote:

@gerald1248 https://github.com/gerald1248 Ok. I will make a commit and pull request

I have this problem with my game. Is this fix on version 3.2 stable? or do I have to recompile from the latest master? (I actually tried, but the export templates I got gave me errors when exporting).

@ealataur https://github.com/ealataur can you please share which export templates you used after you recompiled godot with the fix?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/7966?email_source=notifications&email_token=AAFWFQGABAG3YVEOHAOIJSDQ3GAR3A5CNFSM4DCPOT32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHZTMFQ#issuecomment-569587222, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFWFQCLZGDHZIW3QVLHBC3Q3GAR3ANCNFSM4DCPOT3Q .

@gerald1248 Ok. I will make a commit and pull request

Hi all. I removed duplicated drawView and moving this part of code from

- (void)drawView {
	if (useCADisplayLink) {
		// Pause the CADisplayLink to avoid recursion
		[displayLink setPaused:YES];

		// Process all input events
		while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.01, TRUE) == kCFRunLoopRunHandledSource)
			;

		// We are good to go, resume the CADisplayLink
		[displayLink setPaused:NO];
	}

	if (!active) {
		printf("draw view not active!\n");
		return;
	};

to

- (void)drawView {

	if (!active) {
		printf("draw view not active!\n");
		return;
	};

	if (useCADisplayLink) {
		// Pause the CADisplayLink to avoid recursion
		[displayLink setPaused:YES];

		// Process all input events
		while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.01, TRUE) == kCFRunLoopRunHandledSource)
			;

		// We are good to go, resume the CADisplayLink
		[displayLink setPaused:NO];
	}

And crashes is gone. Tested many time and not catched yet.

According to the verge (https://www.theverge.com/2019/9/19/20874293/apple-ios-13-1-ipados-september-24th-early-release-date-update-bug-fixes-features) ios 13.1 will be out on the 24th. This bug doesn’t exist on the 13.1 beta that I’m currently in but did in a previous 13 beta. Maybe the issue will be patched in 13.1?

“More importantly, Apple promises that 13.1 will bring general bug fixes to iOS 13, which the current software could definitely benefit from. (Our review of the current 13.0 software notes a litany of issues we encountered while testing the new update.)”

Did some tests and I discovered it was not due to the low processor mode but due to the ios13 beta. When not on a beta firmware for iOS I’m not having any crashes on exit.

It seems to me that this can be the same issue as (see the last comment) https://github.com/godotengine/godot/issues/5426