void Sprite::setTexture(const Texture& texture, bool resetRect)
{
...
m_texture = &texture;
}
When you set the texture of a sprite, all it does internally is to keep a pointer to the texture instance. Therefore, if the texture is destroyed or moves elsewhere in memory, the sprite ends up with an invalid texture pointer.