1
Graphics / Confusion concerning sf::Image pointers
« on: February 28, 2010, 06:59:29 am »
My current project is crashing at exit, complaining about corruption of the heap.
It seems to me that the problem is my image objects are being deleted a second time on exit! The crashing/heap problem goes away if I just remove the line where I manually delete my image.
Here's some code, try it for yourself (I'm using SFML2 revision 1429, Visual C++ 2008 Express). Put a breakpoint in Image::~Image in Image.cpp, and run this code. It breaks twice: once on my delete and another at the end of the program.
Is this standard behaviour for SFML?
It seems to me that the problem is my image objects are being deleted a second time on exit! The crashing/heap problem goes away if I just remove the line where I manually delete my image.
Here's some code, try it for yourself (I'm using SFML2 revision 1429, Visual C++ 2008 Express). Put a breakpoint in Image::~Image in Image.cpp, and run this code. It breaks twice: once on my delete and another at the end of the program.
Code: [Select]
#include <SFML/Graphics.hpp>
sf::Image* Image;
int main()
{
Image = new sf::Image;
delete Image;
return 0;
}
Is this standard behaviour for SFML?