Sorry about waste your time, Jules. I can imagine how annoyed my posts are... but if I could location the wrong code, I would have solved it alreay, so why would I spent so many time ask so many stupid questions? I hate myself...
JUCE-Demo used FileChooser instead of FileChooserDialogBox directly. I know this problem absolutly couldn't reproduce with FileChooser, which I always use and like it (unfortunately, Android doesn't). I'm not sure whether my code has bugs or not since this is the first time I dealing with FileChooserDialogBox, but it seems ok to me. Please check it below:
WildcardFileFilter wildcardFilter ("*.jpg;*.png", String::empty, "Image files");
ImagePreviewComponent previewComponent;
FileBrowserComponent browser (FileBrowserComponent::openMode |
FileBrowserComponent::canSelectFiles,
File::nonexistent,
&wildcardFilter,
&previewComponent);
FileChooserDialogBox dialogBox ("Open an image file", "Please choose...",
browser, false, Colours::lightgrey);
if (dialogBox.show())
// ...
It's simple to reproduce the problem, just compile the code above on OSX and click a folder. Sorry I'm going to waste your time again...
I tried to track it. After many many assembler codes, the last line before hit the jassert is:
input.setPosition (streamPos); in juce_ImageFileFormat.cpp.
ImageFileFormat* ImageFileFormat::findImageFormatForStream (InputStream& input)
{
const int64 streamPos = input.getPosition();
for (ImageFileFormat** i = DefaultImageFormats::get(); *i != nullptr; ++i)
{
const bool found = (*i)->canUnderstand (input);
input.setPosition (streamPos); // <--------- this line
if (found)
return *i;
}
return nullptr;
}
(are these info helpful? )
OSX 10.10.4, Xcode 6.4 (6E35b), JUCE from github few days ago.