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 - emscripten: assertion about device->hidden on device opening
Summary: emscripten: assertion about device->hidden on device opening
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: 2.0.8
Hardware: Other Other
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-26 14:16 UTC by beuc
Modified: 2018-11-18 14:36 UTC (History)
0 users

See Also:


Attachments
emscripten-audit-assert.patch (523 bytes, patch)
2018-05-26 14:16 UTC, beuc
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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