Lubuntu 13.04 64 bit, g++ 4.7, SFML2 from github (very recent build).
#include <SFML/Graphics.hpp>
int main()
{
sf::Texture tex;
text.loadFromFile("data/"); //CRASH if data folder actually exists
//alternative version:
text.loadFromFile("data"); //CRASH if data folder actually exists
}
There will be seg fault on loadFromFile when the dir actually exist. When the folder "data" doesn't exist in app's location there is no seg fault. It may be linux-only as well.
Call stack:
0 0x00007ffff78bf66c stbi_load
1 0x00007ffff78c33f4 sf::priv::ImageLoader::loadImageFromFile(std::string const&, std::vector<unsigned char, std::allocator<unsigned char> >&, sf::Vector2<unsigned int>&)
2 0x00007ffff78c8843 sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)
I encountered this bug in following situation: (so it's a bug which may affect some ppl in rare situations)
sf::Texture tex;
std::string textureDir = "data/";
std::string textureName = map.getTextureName(..); // by error in map file, it returned empty string
tex.loadFromFile(textureDir+textureName);
What I expect in above case is that loadFromFile will return false and I will have an empty texture.
However, it simply crashed.
Remember that it must be existing folder as the function argument. When I set:
textureDir = "muhahadfjs2343434/";
Then there is no crash and expected output in console:
Failed to load image "muhahadfjs2343434/". Reason : Unable to open file
I hope that you will look into it. I can provide more debug info if you want.