dinput: Unacquire device when last public reference is released.

Avoid crashing in dinput_device_destroy, calling Unacquire while device
resources may be already freed up.

Signed-off-by: Ivo Ivanov <logos128@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ivo Ivanov 2021-11-12 09:49:38 +01:00 committed by Alexandre Julliard
parent dbb735efd1
commit 99fc12f9a3
1 changed files with 1 additions and 2 deletions

View File

@ -740,8 +740,6 @@ void dinput_device_destroy( IDirectInputDevice8W *iface )
TRACE( "iface %p.\n", iface );
IDirectInputDevice_Unacquire(iface);
free( This->data_queue );
/* Free data format */
@ -768,6 +766,7 @@ static ULONG WINAPI dinput_device_Release( IDirectInputDevice8W *iface )
if (!ref)
{
IDirectInputDevice_Unacquire( iface );
if (impl->vtbl->release) impl->vtbl->release( iface );
else dinput_device_destroy( iface );
}