-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Memory corruption in SDL Audio #79
Comments
Okay thanks! Want to contribute a fix? |
Looks like the problem is that
|
Both are possible (letting users choose) by adding a new methods (with something like a |
I don't think AudioDevice should be dropped very frequently so not too worried about adding ref counting there |
And what about |
Hm, that I'm less sure of but ref counting seems pretty cheap |
Hi, i am porting my SDL2 code to SDL3 code. It will check that the audio is initialized or not. If not, the program will skip the audio portion. Otherwise the audio is played using queue instead of callback.
However, recently found out that in the line "let audio_stream = if let Ok(audio_subsystem) = audio_subsystem {" is causing issue. The audio_subsystem will be deallocated too early and causing ACCESS_VIOLATION or HEAP_CORRUPTION error. This can be solved by changing to "let audio_stream = if let Ok(ref audio_subsystem) = audio_subsystem {".
This issue did not happened in SDL2 crate but in SDL3 crate.
Shown below is the code to demonstrate the problem.
The text was updated successfully, but these errors were encountered: