Skip to content

Fix AudioStreamPlaybackMicrophone shutdown crash#116299

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
ExpiredPopsicle:fix_mic_input_crash
Feb 18, 2026
Merged

Fix AudioStreamPlaybackMicrophone shutdown crash#116299
Repiteo merged 1 commit into
godotengine:masterfrom
ExpiredPopsicle:fix_mic_input_crash

Conversation

@ExpiredPopsicle

@ExpiredPopsicle ExpiredPopsicle commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

Fixed AudioStreamPlaybackMicrophone rarely attempting to use the AudioServer singleton when it is null, on shutdown.

fixes #116298

@Ivorforce

Ivorforce commented Feb 15, 2026

Copy link
Copy Markdown
Member

I'm not sure this is the right approach to fix this.
I'd expect the AudioServer to be available when AudioStreamPlayback destructs.
Or in other words, I'd expect AudioStreamPlayback instances to destruct before AudioServer destructs.

If we fix this potential error here, but in other stream playbacks, we're leaving the same kind of bug open in other spots as well.

@ExpiredPopsicle

Copy link
Copy Markdown
Contributor Author

I've modified the PR to be a more generalized fix, and added a more detailed breakdown of the root cause of the bug in the bug report ( #116298 ).

@Ivorforce Ivorforce left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! Looks good to me, good sleuthing work!

Reading your explanation, i guess it may actually make sense to also check for AudioServer nullptr in AudioStreamPlayback destruction, just in case someone is incorrectly destructing those after the server is shutdown.

But the fix to clean up lists before clearing the singleton is a good change anyway, and I think we should merge it.

@Ivorforce Ivorforce added this to the 4.x milestone Feb 15, 2026
@AThousandShips AThousandShips changed the title Fixed AudioStreamPlaybackMicrophone shutdown crash Feb 16, 2026
@Repiteo Repiteo modified the milestones: 4.x, 4.7 Feb 16, 2026
@Repiteo

Repiteo commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

Could you squash your commits?

@ExpiredPopsicle

Copy link
Copy Markdown
Contributor Author

I was attempting to squash the commits but it looks like I screwed it up.

@Ivorforce

Ivorforce commented Feb 16, 2026

Copy link
Copy Markdown
Member

Try using the following:

git reset --hard 7842b74

7842b74 was your commit before the squash. You should be able to re-attempt a squash afterwards.

…emoved.

This allows objects requiring the singleton for cleanup avoid a null pointer de-reference.

fixes godotengine#116298
@ExpiredPopsicle

Copy link
Copy Markdown
Contributor Author

Okay. I managed to squash all the commits down, I think. Sorry about that.

@ExpiredPopsicle

Copy link
Copy Markdown
Contributor Author

I'm not sure what's going on with that failed test. Might need a re-run?

@Repiteo Repiteo merged commit 8db94f7 into godotengine:master Feb 18, 2026
47 of 67 checks passed
@Repiteo

Repiteo commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

Thanks!

@akien-mga akien-mga added the cherrypick:4.6 Considered for cherry-picking into a future 4.6.x release label Feb 18, 2026
@Repiteo

Repiteo commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Cherry-picked for 4.6.2.

@Repiteo Repiteo removed the cherrypick:4.6 Considered for cherry-picking into a future 4.6.x release label Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment