Thread safety for ID3v1 genres

Scott Wheeler wheeler at
Mon May 2 09:32:22 CEST 2011

On May 1, 2011, at 7:04 PM, Stephen F. Booth wrote:

> I've been experiencing a crash that I can reproduce 100% of the time,
> but I'm struggling on coming up with a good fix.

In theory the new atomic ref counting in trunk should solve this.  Can you see if you can still reproduce it with trunk?

>     static const int genresSize = 148;
> -    static const String genres[] = {
> +    static const char * genres[] = {
>       "Blues",

This is actually one of those things that I've mentioned that if TagLib wants to be truly reentrant that the static initializers (which there are a fair number of) will need to be possible to invoke manually, mutexed or to go away.  While I doubt the initialization the problem there, the function is fundamentally not reentrant since there's a possible race condition on the first call to the function.


More information about the taglib-devel mailing list