We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1986 - Access violation in SDL_audio.c in SDL_RunAudio()
Summary: Access violation in SDL_audio.c in SDL_RunAudio()
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: 2.0.0
Hardware: x86 Windows 7
: P1 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.0
Depends on:
Blocks:
 
Reported: 2013-07-25 14:50 UTC by Leeor Dicker
Modified: 2013-07-30 23:59 UTC (History)
0 users

See Also:


Attachments
'friendly' debug info (70.81 KB, image/png)
2013-07-25 14:50 UTC, Leeor Dicker
Details
Disassembly info (15.00 KB, image/png)
2013-07-25 14:51 UTC, Leeor Dicker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Leeor Dicker 2013-07-25 14:50:31 UTC
Created attachment 1252 [details]
'friendly' debug info

Crash appears after updating to latest SDL2 RC. After building from source myself, there appears to be an issue within SDL2 which appears to access a NULL pointer. The crash only occurs during exiting of the program and only when the debugger is attached (it would appear Windows 7 ignores the exception in both debug/release modes when the program is already terminating).

Crash occurs in both Release and Debug modes.

Attached is a screenshot with debugger information as best as I can retrieve it. I'm unfamiliar with SDL's audio code and hope that the information I'm providing is helpful.

As a note, this happens at the same point every time I attempt to terminate SDL and seems to happen after I've shut down the SDL audio subsystems.
Comment 1 Leeor Dicker 2013-07-25 14:51:21 UTC
Created attachment 1253 [details]
Disassembly info

Dissassembly info
Comment 2 Leeor Dicker 2013-07-30 16:01:56 UTC
Would like to post an update. I have found either a work-around or a possible issue with documentation when migrating from SDL1.2 to SDL2.0.

Adding a call to SDL_CloseAudio() prior to calling Mix_Quit() and SDL_QuitSubSystem(SDL_INIT_AUDIO) resolves this problem.

Calling it after these two calls and the crash remains.

I'm now unsure in what order I should be calling these functions and what functions I should or should not be calling. As a note, this is a project that used SDL1.2 and recently switched to SDL 2.0, first with Hg versions and now the latest RC.

As a further side note, I never do call SDL_OpenAudio() anywhere in the code which is why I never thought to use (or even knew about) SDL_CloseAudio(). On a whim I disabled the calls to Mix_Quit and SDL_QuitSubSystem so that's when I went exploring.

Should I be init'ing SDL_Audio and SDL_Mixer differently than I currently do? I'll be happy to update wiki documentation but I have no information about what assumptions are made and so on (forgive my wordiness, want to be sure I include all relevant information and offer assistance where possible).
Comment 3 Leeor Dicker 2013-07-30 16:08:39 UTC
Final comment for now as I believe I have resolved the error on my side. As suspected it was a bug in my code.

I used SDL_Mixer's Mixer_OpenAudio() and never called Mixer_CloseAudio(). For whatever reason it never posed a problem until the recent SDL2 RC release which probably did a better job cleaning up after itself (just a guess).

This issue can be marked as resolved.
Comment 4 Sam Lantinga 2013-07-30 23:59:31 UTC
Thanks for following up! :)