Hey,
I'm very new to SFML, so I don't know the guts of it.
However, I couldn't help but notice that no destructors in any of the classes are declared virtual, which could cause memory leaks when trying to inherit them, and using a base pointer to address the object.
This is an example of what I mean:
class cDerivedTexture : public sf::Texture
{
public:
cDerivedTexture( void );
~cDerivedTexture( void );
private:
// stuff, not really important
};
// Then, later on...
// make a new texture
sf::Texture* myTexture = new cDerivedTexture();
/* --- SNIP --- */
// now delete the texture
delete myTexture; // Oh oh, destructor of sf::Texture isn't called!
I'm going to assume the destructor sf::Texture::~Texture() plays an important role in freeing up memory of loaded images, but in the above example, it isn't called when deleting the derived texture class.
The fix would be to make it virtual:
// The SFML texture class
class Texture
{
// destructor of sf::Texture
virtual ~Texture();
// other stuff
}
Any thoughts or ideas?
TheComet