From 4bfd3a65068479a09087f293af02fbdd4e627add Mon Sep 17 00:00:00 2001 From: Gliniak Date: Sun, 6 Feb 2022 12:29:07 +0100 Subject: [PATCH] Reset state of event before executing overlap code --- src/xenia/kernel/kernel_state.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/xenia/kernel/kernel_state.cc b/src/xenia/kernel/kernel_state.cc index 934fcfece..93c74b527 100644 --- a/src/xenia/kernel/kernel_state.cc +++ b/src/xenia/kernel/kernel_state.cc @@ -813,6 +813,14 @@ void KernelState::CompleteOverlappedDeferredEx( auto ptr = memory()->TranslateVirtual(overlapped_ptr); XOverlappedSetResult(ptr, X_ERROR_IO_PENDING); XOverlappedSetContext(ptr, XThread::GetCurrentThreadHandle()); + X_HANDLE event_handle = XOverlappedGetEvent(ptr); + if (event_handle) { + auto ev = object_table()->LookupObject(event_handle); + assert_not_null(ev); + if (ev) { + ev->Reset(); + } + } auto global_lock = global_critical_region_.Acquire(); dispatch_queue_.push_back([this, completion_callback, overlapped_ptr, pre_callback, post_callback]() {