I just upgraded to the latest version of SFML in the hopes of fixing a small problem, but it seems like I've just created a much bigger one. I was able to put sf::Text objects in vectors in the old version but now doing so causes my program to crash.
This code causes a bad_alloc error:
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
int main()
{
sf::Text t;
std::vector<sf::Text> vec;
vec.push_back(t);
return 0;
}
Pushing a sf::Sprite object into a vector of Sprites works fine. Only sf::Text is causing this issue. sizeof(sf::Text) is 260 bytes while sizeof(sf::Sprite) is 272 bytes so I don't think it has anything to do with memory shortage.
Did I install something wrong or can we not put sf::Text objects in containers?