My application using ViGEmClient crashes when calling vigem_target_x360_unregister_notification().
When NotificationRequestPool::~NotificationRequestPool() calls CloseHandle(wait_handle),
in void NotificationRequestPool::operator()()
// wait for the first pending I/O to signal its event
const auto ret = WaitForMultipleObjects(
requests_.size(),
wait_handles_,
FALSE, // first one to be signaled wins
25 // don't block indefinitely so worker can be canceled
);
returns WAIT_FAILED (0xFFFFFFFF).
Then
// grab associated request
const auto req = requests_[index].get();
with index = 0xFFFFFFFF causes a memory access violation.
I added some code checking whether WaitForMultipleObjects() returned WAIT_FAILED.
Another solution
Or calling NotificationRequestPool::terminate(); Sleep(100); from destructor before closing the handle also fixes the problem.
My application using ViGEmClient crashes when calling
vigem_target_x360_unregister_notification()
.When
NotificationRequestPool::~NotificationRequestPool()
callsCloseHandle(wait_handle)
,in
void NotificationRequestPool::operator()()
returns
WAIT_FAILED (0xFFFFFFFF)
.Then
with
index = 0xFFFFFFFF
causes a memory access violation.I added some code checking whether
WaitForMultipleObjects()
returnedWAIT_FAILED
.Another solution
Or calling
NotificationRequestPool::terminate(); Sleep(100);
from destructor before closing the handle also fixes the problem.My build enviroment
Thanks,