Skip to content

Fixed a crash when quitting while sounds are still being loaded - #290

Open
Causeless wants to merge 4 commits into
developmentfrom
fixed-quit-while-loading-sounds-crash
Open

Causeless wants to merge 4 commits into
developmentfrom
fixed-quit-while-loading-sounds-crash

Conversation

@Causeless

@Causeless Causeless commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

FMOD loads sounds asynchronously, on a thread of its own, and it takes a while after launching for it to get through all of them. This would cause a crash if the game exited soon after launch.

Claude used a literal sleep here, which feels ugly (we don't have a promise to wait on from FMOD?) but I don't care because this is such an edge case.

Causeless and others added 2 commits October 10, 2026 13:56
FMOD loads sounds asynchronously, on a thread of its own, and it takes a
while after launching for it to get through all of them. Quitting before
then had the audio system get released with sounds still loading (around
980 of them one sim update into an Activity launched straight into), which
every so often crashed on that thread.

AudioMan now waits for the loading to finish before it releases the audio
system. That only takes any time when quitting that soon after launching,
and then a second or two.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d on

Waiting for FMOD to be done loading sounds before releasing the audio system
was done by checking each sound's state in a loop, sleeping in between.

FMOD does that waiting itself when a sound that is still being loaded gets
released, and it wants all sounds released before the audio system anyway,
which was never done. So the sounds get released now, and the loop is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Causeless

Copy link
Copy Markdown
Contributor Author

Got a more sensible solution instead of the hack sleep that Claude initially used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant