Commit 99fc12f9 authored by Ivo Ivanov's avatar Ivo Ivanov Committed by Alexandre Julliard

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: 's avatarIvo Ivanov <logos128@gmail.com> Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent dbb735ef
...@@ -740,8 +740,6 @@ void dinput_device_destroy( IDirectInputDevice8W *iface ) ...@@ -740,8 +740,6 @@ void dinput_device_destroy( IDirectInputDevice8W *iface )
TRACE( "iface %p.\n", iface ); TRACE( "iface %p.\n", iface );
IDirectInputDevice_Unacquire(iface);
free( This->data_queue ); free( This->data_queue );
/* Free data format */ /* Free data format */
...@@ -768,6 +766,7 @@ static ULONG WINAPI dinput_device_Release( IDirectInputDevice8W *iface ) ...@@ -768,6 +766,7 @@ static ULONG WINAPI dinput_device_Release( IDirectInputDevice8W *iface )
if (!ref) if (!ref)
{ {
IDirectInputDevice_Unacquire( iface );
if (impl->vtbl->release) impl->vtbl->release( iface ); if (impl->vtbl->release) impl->vtbl->release( iface );
else dinput_device_destroy( iface ); else dinput_device_destroy( iface );
} }
......
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