浏览代码

Merge pull request #2153 from tujinshu/master

win-capture: Fix rare crash when OpenGL programs exit with graphics-hook
Jim 6 年之前
父节点
当前提交
f41d0d9d77
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      plugins/win-capture/graphics-hook/gl-capture.c

+ 2 - 2
plugins/win-capture/graphics-hook/gl-capture.c

@@ -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();