win-capture/graphics-hook: Check if mutex abandoned
It's possible that the mutexes used with shared memory capture to return WAIT_ABANDONED if OBS is shut down abnormally while the mutex is locked.
This commit is contained in:
parent
b2bc1e159b
commit
f6581952bc
@ -467,10 +467,15 @@ uint64_t os_gettime_ns(void)
|
||||
static inline int try_lock_shmem_tex(int id)
|
||||
{
|
||||
int next = id == 0 ? 1 : 0;
|
||||
DWORD wait_result = WAIT_FAILED;
|
||||
|
||||
if (WaitForSingleObject(tex_mutexes[id], 0) == WAIT_OBJECT_0) {
|
||||
wait_result = WaitForSingleObject(tex_mutexes[id], 0);
|
||||
if (wait_result == WAIT_OBJECT_0 || wait_result == WAIT_ABANDONED) {
|
||||
return id;
|
||||
} else if (WaitForSingleObject(tex_mutexes[next], 0) == WAIT_OBJECT_0) {
|
||||
}
|
||||
|
||||
wait_result = WaitForSingleObject(tex_mutexes[next], 0);
|
||||
if (wait_result == WAIT_OBJECT_0 || wait_result == WAIT_ABANDONED) {
|
||||
return next;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user