[PATCH] dinput: Trace reference count in a consistent way

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Fri Jun 7 00:46:40 CDT 2019


Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/dinput/device.c            | 4 +++-
 dlls/dinput/dinput_main.c       | 4 ++--
 dlls/dinput/effect_linuxinput.c | 6 +++++-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index c9d24a9174..0c75a6ec36 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -1215,7 +1215,9 @@ HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A ifa
 ULONG WINAPI IDirectInputDevice2WImpl_AddRef(LPDIRECTINPUTDEVICE8W iface)
 {
     IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
-    return InterlockedIncrement(&This->ref);
+    ULONG ref = InterlockedIncrement(&This->ref);
+    TRACE( "(%p) ref %d\n", This, ref );
+    return ref;
 }
 
 ULONG WINAPI IDirectInputDevice2AImpl_AddRef(LPDIRECTINPUTDEVICE8A iface)
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index c02bafad10..0855cb41cd 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -528,7 +528,7 @@ static ULONG WINAPI IDirectInputAImpl_AddRef(LPDIRECTINPUT7A iface)
     IDirectInputImpl *This = impl_from_IDirectInput7A( iface );
     ULONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE( "(%p) incrementing from %d\n", This, ref - 1);
+    TRACE( "(%p) ref %d\n", This, ref );
     return ref;
 }
 
@@ -543,7 +543,7 @@ static ULONG WINAPI IDirectInputAImpl_Release(LPDIRECTINPUT7A iface)
     IDirectInputImpl *This = impl_from_IDirectInput7A( iface );
     ULONG ref = InterlockedDecrement( &This->ref );
 
-    TRACE( "(%p) releasing from %d\n", This, ref + 1 );
+    TRACE( "(%p) ref %d\n", This, ref );
 
     if (ref == 0)
     {
diff --git a/dlls/dinput/effect_linuxinput.c b/dlls/dinput/effect_linuxinput.c
index 7477bc757d..4b2f317ce3 100644
--- a/dlls/dinput/effect_linuxinput.c
+++ b/dlls/dinput/effect_linuxinput.c
@@ -167,7 +167,9 @@ static ULONG WINAPI LinuxInputEffectImpl_AddRef(
 	LPDIRECTINPUTEFFECT iface)
 {
     LinuxInputEffectImpl *This = impl_from_IDirectInputEffect(iface);
-    return InterlockedIncrement(&(This->ref));
+    ULONG ref = InterlockedIncrement(&This->ref);
+    TRACE( "(%p) ref %d\n", This, ref );
+    return ref;
 }
 
 static HRESULT WINAPI LinuxInputEffectImpl_Download(
@@ -759,6 +761,8 @@ static ULONG WINAPI LinuxInputEffectImpl_Release(LPDIRECTINPUTEFFECT iface)
     LinuxInputEffectImpl *This = impl_from_IDirectInputEffect(iface);
     ULONG ref = InterlockedDecrement(&(This->ref));
 
+    TRACE( "(%p) ref %d\n", This, ref );
+
     if (ref == 0)
     {
         LinuxInputEffectImpl_Stop(iface);
-- 
2.17.1



More information about the wine-devel mailing list