I have no problem creating and using shapes stored in a vector but when I try and close the window while using a shape stored in a vector I "trigger a breakpoint".
The error is being thrown from free.c from a function used to free a memory block in the heap.
What exactly is happening and why is there a problem freeing memory?
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
sf::RectangleShape rect1(sf::Vector2f(100,50));
rect1.setFillColor(sf::Color(255,0,0));
std::vector <sf::RectangleShape> vectorRect(1);
vectorRect[0]=rect1;
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.draw(vectorRect[0]);
window.display();
}
return 0;
}