Clean shutdown
Hi,
I've just started trying to integrate oculus to my game engine and i am having issues to perform a clean shutdown.
I am trying to wrap oculus access inside a OculusWrapper class.
I get a pointer to this wrapper in my game, and on exit, i call oculus shutdown, then free my wrapper. AFAIK this should work in theory, but it doesn't, and i get an Access Violation exception. I am no C++ expert so it might be totally my fault, but i can't see where the issue is.
Code sample :
Exception :
Unhandled exception at 0x77091A91 in Light.exe: 0xC0000005: Access violation executing location 0x00000000.
If i don't call shutdown, i don't get any exception, but i'd like to do things properly.
Any idea ?
I've just started trying to integrate oculus to my game engine and i am having issues to perform a clean shutdown.
I am trying to wrap oculus access inside a OculusWrapper class.
I get a pointer to this wrapper in my game, and on exit, i call oculus shutdown, then free my wrapper. AFAIK this should work in theory, but it doesn't, and i get an Access Violation exception. I am no C++ expert so it might be totally my fault, but i can't see where the issue is.
Code sample :
// OculusWrapper.cpp
OculusWrapper::OculusWrapper(): mHmd(0)
{
}
void OculusWrapper::Initialize()
{
ovr_Initialize();
mHmd = ovrHmd_Create(0);
if (mHmd)
{
ovrSizei resolution = mHmd->Resolution;
}
}
void OculusWrapper::Shutdown()
{
if (mHmd)
{
ovrHmd_Destroy(mHmd);
ovr_Shutdown();
}
}
OculusWrapper::~OculusWrapper()
{
}
// LightGame.cpp
LightGame::LightGame(HINSTANCE hInstance)
: mOculusWrapper(nullptr)
{
...
mOculusWrapper = new OculusWrapper();
mOculusWrapper->Initialize();
...
}
LightGame::~LightGame()
{
...
mOculusWrapper->Shutdown();
delete mOculusWrapper;
...
}
Exception :
Unhandled exception at 0x77091A91 in Light.exe: 0xC0000005: Access violation executing location 0x00000000.
If i don't call shutdown, i don't get any exception, but i'd like to do things properly.
Any idea ?
