A game I am developing crashes on shutdown if OBS Studio has been recording its gameplay.
It does not crash if recording, then shutting down OBS, then shutting down the game.
I am using OBS Studio 0.16.5 on Windows 7 x64.
My game uses SDL2, portaudio, glew, and OpenGL 4.3.
I thought the problem was the graphics being destroyed too early, while still being in use by OBS maybe. But my graphics engine is static and unloads SDL and OpenGL in its destructor, so it happens as late as possible afaik?
I tried the same thing in Dota2, and this game doesn't crash when closing and recording with OBS. So the problem is in my game.
I guess I am not unloading these dll hooks from OBS correctly or something. What to do?
Exception:
Exception thrown at 0x0000000069F8DC38 (nvoglv64.dll) in MyGame.exe: 0xC0000005: Access violation reading location 0x00000000000C8E98.
Callstack:
> nvoglv64.dll!0000000069f4dc38()
nvoglv64.dll!0000000069f518c6()
nvoglv64.dll!0000000069e7f56c()
nvoglv64.dll!0000000069e81441()
graphics-hook64.dll!000007fee53d4428()
graphics-hook64.dll!000007fee53d5a44()
[External Code]
Log file:
http://pastebin.com/ikEhDc3G
If i dont destroy the graphics engine, but let it leak on shutdown. I get a crash in opengl32.dll instead:
> opengl32.dll!MakeAnyCurrent()
opengl32.dll!wglMakeCurrent()
graphics-hook64.dll!000007fee53d5a3f()
[External Code]
So it looks like OBS is injecting graphics-hook64.dll that tries to record from a window that doesnt exist anymore when the game has closed. So how do I shutdown this graphics-hook64?
It does not crash if recording, then shutting down OBS, then shutting down the game.
I am using OBS Studio 0.16.5 on Windows 7 x64.
My game uses SDL2, portaudio, glew, and OpenGL 4.3.
I thought the problem was the graphics being destroyed too early, while still being in use by OBS maybe. But my graphics engine is static and unloads SDL and OpenGL in its destructor, so it happens as late as possible afaik?
I tried the same thing in Dota2, and this game doesn't crash when closing and recording with OBS. So the problem is in my game.
I guess I am not unloading these dll hooks from OBS correctly or something. What to do?
Exception:
Exception thrown at 0x0000000069F8DC38 (nvoglv64.dll) in MyGame.exe: 0xC0000005: Access violation reading location 0x00000000000C8E98.
Callstack:
> nvoglv64.dll!0000000069f4dc38()
nvoglv64.dll!0000000069f518c6()
nvoglv64.dll!0000000069e7f56c()
nvoglv64.dll!0000000069e81441()
graphics-hook64.dll!000007fee53d4428()
graphics-hook64.dll!000007fee53d5a44()
[External Code]
Log file:
http://pastebin.com/ikEhDc3G
If i dont destroy the graphics engine, but let it leak on shutdown. I get a crash in opengl32.dll instead:
> opengl32.dll!MakeAnyCurrent()
opengl32.dll!wglMakeCurrent()
graphics-hook64.dll!000007fee53d5a3f()
[External Code]
So it looks like OBS is injecting graphics-hook64.dll that tries to record from a window that doesnt exist anymore when the game has closed. So how do I shutdown this graphics-hook64?