Havok terminates call in destructor, throwing Unhandled exception

When I program using havok, I had a crash when exiting the program,

I have an envlope of the havok function for the C ++ class to make the main function simple, and I call the havok quit functions in the destructor of my class, but this may cause an “Unhandled exception” to fail.

If I get the hook out of the destructor function and put it in the main function, everything will be fine. I just wondered why this does not work in the destructor, but it works in the main function?

my code is:

int HK_CALL main(int argc, const char** argv)  
{  
    HKUTI *myhk = new HKUTI(setupPhysics, 1000);  
    myhk->run(displayGraphics, 60, 30);  

    delete(myhk);  
    myhk = NULL;  

    hkBaseSystem::quit();  
    hkMemoryInitUtil::quit();  
    return 0;  
}

havok quit - hkBaseSystem:: quit(); hkMemoryInitUtil:: quit(); , , , 2 quit HKUTI, , . - , - , ++?

+3
2

Havok, , , quit :

  • hkBaseSystem::quit();
  • hkMemoryInitUtil::quit();

, HKUTI, . , ( , HKUTI!) delete myhk; hkBaseSystem::quit();.

+1

-, Havok Intel , Havok. .

? , , , HKUTI Havok hkBaseSystem:: quit(). Havok new/delete, hkMemorySystem. , Havok hkBaseSystem:: quit(), , hkMemorySystem:: getInstance() NULL.

, .

0

Source: https://habr.com/ru/post/1787530/


All Articles