Not thread safe in every build environment! Try calling findImageFormatForStream () once from your message thread to initialize it safely as a workaround.
But Jules should really fix this once and for all…I posted extensively on this topic elsewhere.
None of the graphics code was ever designed to be thread-safe! Making everything safe would have been enormously complicated, so although a lot of it will work (and certainly the image-loading should be ok), it comes with no guarantee!
In fact, looking at that bit of code again, it’d have been better to write it as a file static, e.g.
…since there’s no real space or time saving in lazily creating the format objects (which are basically just empty objects), and writing it this way will make the compiler produce far less boilerplate code, as well as avoiding your threading issues.