| Summary: | Subsystem refcounting is trashed by SDL_Init | ||
|---|---|---|---|
| Product: | SDL | Reporter: | (disabled) Jørgen Tjernø <jorgen> |
| Component: | main | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P1 | Keywords: | target-2.0.0 |
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: |
'hg import'-compatible patch that fixes this issue
'hg import'-compatible patch that fixes this issue 'hg import'-compatible patch that fixes this issue 'hg import'-compatible patch that fixes this issue |
||
|
Description
(disabled) Jørgen Tjernø
2013-02-06 14:27:06 UTC
Sorry, the paragraph after the example code was supposed to read: "The joystick subsystem is *not* shut down by SDL_QuitSubSystem (because the refcount underflows when you run QuitSubSystem)." Created attachment 1034 [details]
'hg import'-compatible patch that fixes this issue
Created attachment 1035 [details]
'hg import'-compatible patch that fixes this issue
Left an #include <stdio.h> in there from debugging.
The unit tests are a nice touch. :) A couple of style suggestions: * msb32_idx() isn't a portable function. Maybe you should add something to SDL_stdinc.h? * How about moving the incr and decr functions together so they're easy to see in one place? Created attachment 1036 [details]
'hg import'-compatible patch that fixes this issue
I moved msb32_idx into SDL_bits.h, and named it SDL_MostSignificantBitIndex.\
I also fixed a bug with SDL_AudioInit in the new system (it was deiniting itself on init, because we updated the WasInit state before invoking the Init function).
SDL_WasInit(SDL_INIT_AUDIO) is an invariant in SDL_AudioInit -- always false -- because we don't call SDL_AudioInit from InitSubSystem unless WasInit(SDL_INIT_AUDIO) was false - so I removed this call.
I also changed it so that we only increment refcount (and change WasInit state) of a subsystem *after* the Init function returns success. This fixes a problem where WasInit() would return true even if a subsystem failed to initialize. It also restores previous behavior of only changing WasInit state *after* init is done.
Created attachment 1037 [details]
'hg import'-compatible patch that fixes this issue
After talking to Sam in person: When the patch is merged, skip the changes to src/audio/SDL_audio.c. (Sorry if you get a lot of copies of this email, we're touching dozens of bug reports right now.) Tagging a bunch of bugs as target-2.0.0, Priority 1. This means we're in the final stretch for an official SDL 2.0.0 release! These are the bugs we really want to fix before shipping if humanly possible. That being said, we don't promise to fix them because of this tag, we just want to make sure we don't forget to deal with them before we bless a final 2.0.0 release, and generally be organized about what we're aiming to ship. Hopefully you'll hear more about this bug soon. If you have more information (including "this got fixed at some point, nevermind"), we would love to have you come add more information to the bug report when you have a moment. Thanks! --ryan. This was committed by Jorgen in revision: http://hg.libsdl.org/SDL/rev/e74a4b282450 |