GlResource::GlResource()
{
...
// Increment the resources counter
count++;
...
}
As far as I can tell, every created instance of GlResource increases the count. I am just wondering, why there is no copy constructor defined that would increase it, too?
The default copy constructor just copies all attributes (which is none).
Therefore, if I am not fully mistaking, it is possible to cause a call to ensureContext() after globalCleanup(), because the count is smaller than the actual number of GlResource instances.
Please tell me, if I am missing something.
EDIT: I just tested, whether a copying of a derived class really calls the parent's copy constructor. And it does. I also tested it without explicit declaration of a copy constructor and the default one is called. Thus, my thoughts are correct. But maybe SFML handles it another way.