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 audio listener crash in stream player #89230

Closed
wants to merge 1 commit into from

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Mar 6, 2024

Fixes the crash in #89212
This is probably a deeper issue though. is_audio_listener_2d() is supposed to ensure that listener exists, but it doesn't. Maybe there is some threading involved here.
The problem seems to exist only in 2D.

@KoBeWi KoBeWi added this to the 4.3 milestone Mar 6, 2024
@KoBeWi KoBeWi requested a review from a team as a code owner March 6, 2024 21:23
@@ -140,6 +140,7 @@ void AudioStreamPlayer2D::_update_panning() {

//screen in global is used for attenuation
AudioListener2D *listener = vp->get_audio_listener_2d();
ERR_FAIL_NULL(listener);
Copy link
Member

Choose a reason for hiding this comment

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

How does it fix a crash? The use of listener before is guarded by if (listener) (which is now made redundant so the else branch would be dead code.

Copy link
Member Author

@KoBeWi KoBeWi Mar 6, 2024

Choose a reason for hiding this comment

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

Huh, that's a good question. It does fix the crash though, I posted stack trace in the issue. But it doesn't make sense .-.
Also I misunderstood what is_audio_listener_2d() is supposed to do.

My guess would be that listener pointer is invalid and this "fix" worked by a pure luck. It completely breaks audio playback though.

@KoBeWi KoBeWi closed this Mar 6, 2024
@KoBeWi KoBeWi deleted the crush_crash branch March 6, 2024 21:57
@KoBeWi KoBeWi added the archived label Mar 6, 2024
@KoBeWi KoBeWi removed this from the 4.3 milestone Mar 6, 2024
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.

2 participants