[PATCH 02/11] dinput: Unacquire device when last public reference is released.

Rémi Bernon rbernon at codeweavers.com
Fri Nov 12 02:49:38 CST 2021


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

From: Ivo Ivanov <logos128 at gmail.com>
Signed-off-by: Ivo Ivanov <logos128 at gmail.com>
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/dinput/device.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index e0d15893bd4..3297e857afa 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -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 );
     }
-- 
2.33.1




More information about the wine-devel mailing list