Commit 54db7610 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

xinput1_3: Wait for CancelIoEx completion when disabling controllers.

Otherwise we may later write the cancelled status to invalid memory. Also use a manual-reset event, as it should be for overlapped I/O, so all waiters are waken up on cancel. Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 5d022fd0
......@@ -354,6 +354,7 @@ static void controller_disable(struct xinput_controller *controller)
controller->enabled = FALSE;
CancelIoEx(controller->device, &controller->hid.read_ovl);
WaitForSingleObject(controller->hid.read_ovl.hEvent, INFINITE);
SetEvent(update_event);
}
......@@ -365,7 +366,7 @@ static BOOL controller_init(struct xinput_controller *controller, PHIDP_PREPARSE
controller->hid.caps = *caps;
if (!(controller->hid.feature_report_buf = calloc(1, controller->hid.caps.FeatureReportByteLength))) goto failed;
if (!controller_check_caps(controller, device, preparsed)) goto failed;
if (!(event = CreateEventA(NULL, FALSE, FALSE, NULL))) goto failed;
if (!(event = CreateEventW(NULL, TRUE, FALSE, NULL))) goto failed;
TRACE("Found gamepad %s\n", debugstr_w(device_path));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment