Merge pull request #2153 from tujinshu/master

win-capture: Fix rare crash when OpenGL programs exit with graphics-hook
This commit is contained in:
Jim
2019-11-05 16:28:13 -08:00
committed by GitHub
@@ -30,6 +30,7 @@ static struct func_hook wgl_swap_buffers;
static struct func_hook wgl_delete_context;
static bool darkest_dungeon_fix = false;
static bool functions_initialized = false;
struct gl_data {
HDC hdc;
@@ -724,7 +725,6 @@ static void gl_shmem_capture(void)
static void gl_capture(HDC hdc)
{
static bool functions_initialized = false;
static bool critical_failure = false;
if (critical_failure) {
@@ -828,7 +828,7 @@ static BOOL WINAPI hook_wgl_delete_context(HGLRC hrc)
{
BOOL ret;
if (capture_active()) {
if (capture_active() && functions_initialized) {
HDC last_hdc = jimglGetCurrentDC();
HGLRC last_hrc = jimglGetCurrentContext();