For reasons I can’t disclose, I am required to setup my project with JUCE_STRING_UTF_TYPE=32.
Has anybody encountered crashes when trying to iterate through a directory using a DirectoryIterator, with the flag specified as such? (Only tested on Windows, x86 application)
Here’s a basic example:
DirectoryIterator iterator (File::getSpecialLocation (File::userDesktopDirectory), false);
while (iterator.next()) //Crashes on iteration
DBG (iterator.getFile().getFullPathName());
I thought so at first, but after commenting out the NativeIterator instance in the DirectoryIterator, the problem was still there… There seems to be something occurring in the DirectoryIterator’s destructor (dangling pointer deletion, or something).
Believe it or not, doing the following eliminates the issue:
It seems “static CharPointerType StringHolder::createFromCharPointer (const CharPointerType start, const CharPointerType end)” never took into account the CharType. And so, the function wasn’t allocating enough memory, and somewhere else later the relating memory was trying to be deleted out of range.