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 4176

Summary: emscripten: assertion about device->hidden on device opening
Product: SDL Reporter: beuc
Component: audioAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.8   
Hardware: Other   
OS: Other   
Attachments: emscripten-audit-assert.patch

Description beuc 2018-05-26 14:16:02 UTC
Created attachment 3250 [details]
emscripten-audit-assert.patch

This assertion triggers on device opening:
    /* if your target really doesn't need it, set it to 0x1 or something. */
    /* otherwise, close_audio_device() won't call impl.CloseDevice(). */
    SDL_assert(device->hidden != NULL);

This field was left at NULL following a clean-up:
    /* Initialize all variables that we clean on shutdown */
#if 0  /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */
    this->hidden = (struct SDL_PrivateAudioData *)

The attached patch initializes the field to 0x1 as suggested.
No more assertion popup on startup :)
Comment 1 beuc 2018-06-29 10:15:44 UTC
The patch also makes SDL2 properly unregister the Emscripten audio hooks when closing audio.
Comment 2 beuc 2018-11-18 14:36:21 UTC
Merged at https://hg.libsdl.org/SDL/rev/9bae6554dd3e