Here are a couple of issues with juce::String that we have encountered.
Juce version 1.53
platform: Windows 7 64-bit
Issue: Thread A copies a juce::String into a struct, and passes that struct to a different thread through a locked juce::Array. The other thread uses the string, which contains a file path, to memory map a file, so the string is converted to wide characters. A crash would happen intermittently (after 1-2 minutes of program use) in thread A, inside the Array’s enter critical section method.
Solution: Instead of copying the juce::String into the struct, allocating a char* and copying the characters manually, then creating a String from it in Thread B right before opening the file made the problem go away.
Issue: Multiple threads call file.existsAsFile as the same time. The file objects are different, but contain the same path. The project will often crash inside makeUniqueWithByteSize(const CharPointerType& text, size_t numBytes) During the execution of the function, text will end up changing, causing the function to crash inside the memcpy
Solution: Place a lock before the call to file.existsAsFile()