raylib
raylib copied to clipboard
[Audio] Bug, Regression: Memory/State Corruption in the ModulePlaying example
- [X] I tested it on latest raylib version from master branch
- [X] I checked there is no similar issue already reported
- [X] My code has no errors or misuse of raylib
Issue description
I updated the Raylib-CsLo (C# Wrapper) to Raylib 4.2. To verify, I run all the examples (all 100+). They all "work", however I run the examples is a little different: They are all run within a single program, with each example scene loaded, run, unloaded. One after eachother.
In doing so, I discovered a bug with the audio system that was not in the raylib 4.0 release. (A Regression). When playing the ModulePlaying Sound example https://github.com/raysan5/raylib/blob/0abba4dc1854e71f58b252e840058178ea845e25/examples/audio/audio_module_playing.c that scene works, being loaded, executed, and unloaded seemingly correctly. But the next audio scene played will always crash upon it's exit. This leads me to belive that something about the multichannel sound streaming example corrupts the internal raylib state, so that the next example fails.
The error is not a thrown exception. The application crashes in the native code somewhere without an exception thrown. (Not visible from my C# debugger)
Environment
Windows 10 x64, running Raylib-CsLo latest (4.2-update branch). Raylib used is master branch, commit 6e8f3b0 (Sept 19th)
Code Example
You can probably see same symptoms by running a single application and running all the audio examples in order, inside the same app. Run the ModulePlaying example first, followed by all the other audio examples.
I had a typo in my initial report. The issue is in the ModulePlaying example. I have edited the original to correct.
It seems the "MusicPlaying" Streaming example also has the same problem.
@jasonswearingen Please, could you test the provided fix?
The provided PR should fix the issue. Reopen if still present.
Thanks Ray, I haven't been able to rebuild my native wrapper but when I do I'll let you know if the issue persists.