Ivo Ivanov : dinput: Unacquire device when last public reference is released.

Alexandre Julliard julliard at winehq.org
Fri Nov 12 16:16:04 CST 2021


Module: wine
Branch: master
Commit: 99fc12f9a337876e3ba916cd20a5ee242acb6fe9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=99fc12f9a337876e3ba916cd20a5ee242acb6fe9

Author: Ivo Ivanov <logos128 at gmail.com>
Date:   Fri Nov 12 09:49:38 2021 +0100

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 at gmail.com>
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 12670a46564..898b1d10ed0 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 );
     }




More information about the wine-cvs mailing list