Commit 947e6ee5 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Wait for the internal thread to complete unacquiring.

Otherwise we may close HID read event before it has finished removing it from the wait handles, causing MsgWaitForMultipleObjectsEx to return an error and terminate. Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 29fae9a7
......@@ -1381,7 +1381,6 @@ static DWORD WINAPI hook_thread_proc(void *param)
mouse_hook = NULL;
}
if (finished_event)
SetEvent(finished_event);
}
}
......@@ -1504,17 +1503,13 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
WARN( "Unable to (un)register raw device %x:%x\n", dev->raw_device.usUsagePage, dev->raw_device.usUsage );
}
if (acquired)
hook_change_finished_event = CreateEventW( NULL, FALSE, FALSE, NULL );
PostThreadMessageW( hook_thread_id, WM_USER+0x10, 1, (LPARAM)hook_change_finished_event );
LeaveCriticalSection(&dinput_hook_crit);
if (acquired)
{
WaitForSingleObject(hook_change_finished_event, INFINITE);
CloseHandle(hook_change_finished_event);
}
}
void check_dinput_events(void)
......
......@@ -4758,9 +4758,6 @@ static void test_simple_joystick(void)
todo_wine
ok( hr == DIERR_UNSUPPORTED, "Escape returned: %#x\n", hr );
/* FIXME: we have to wait a bit because Wine DInput internal thread keeps a reference */
Sleep( 100 );
ref = IDirectInputDevice8_Release( device );
ok( ref == 0, "Release returned %d\n", ref );
......@@ -7227,9 +7224,6 @@ static void test_force_feedback_joystick( void )
ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
set_hid_expect( file, NULL, 0 );
/* FIXME: we have to wait a bit because Wine DInput internal thread keeps a reference */
Sleep( 100 );
ref = IDirectInputDevice8_Release( device );
ok( ref == 0, "Release returned %d\n", ref );
......
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