I’m writing a class and I need to initialize a raw c++ pointer, so in the header I’ve:
class TestCacheAllocator* gCacheAllocator;
And I’ve wrote this functions into the .cpp file
void FPhysXRummy::Init() {
gCacheAllocator = new TestCacheAllocator;
}
void FPhysXRummy::Term() {
if(gCacheAllocator)
delete gCacheAllocator;
}
The problem is that I receive a fatal error on function Term, at this line “delete gCacheAllocator;”
As you can see the pointer is exists, so why the engine crash at this line?