Forum Discussion
adysoft
11 years agoHonored Guest
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 ?
1 Reply
- AlcoJaguarHonored GuestThis may be a bit too late, or may not help much, but I ran into an access violation when calling ovrHmd_Destroy(...) before freeing the mirror texture and swap texture set I created using that HMD structure. Making sure those textures are freed via the LibOVR destroy functions before calling ovrHmd_Destroy(...) fixed my issue. This wasn't a case of the texture destroy functions causing the violation either, it seems that ovrHmd_Destroy(...) will fail if there are any currently allocated textures associated with it, at least in my experience. I don't see you creating any textures in this example, but did you happen to allocate something else you may have overlooked?
I'm currently using 0.6.0.1-beta
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 6 months ago
- 4 years ago