From dba4428b6d2a31c572fd55d64c1f6edc174f47d7 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 7 Jun 2019 06:03:37 +0000 Subject: [PATCH] dinput: Trace reference count in a consistent way. Signed-off-by: Alistair Leslie-Hughes Signed-off-by: Alexandre Julliard --- dlls/dinput/device.c | 6 ++++-- dlls/dinput/dinput_main.c | 4 ++-- dlls/dinput/effect_linuxinput.c | 6 +++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index c9d24a91745..28329d03b50 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1140,7 +1140,7 @@ ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface) IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); ULONG ref = InterlockedDecrement(&(This->ref)); - TRACE("(%p) releasing from %d\n", This, ref + 1); + TRACE("(%p) ref %d\n", This, ref); if (ref) return ref; @@ -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 acf2cf3d236..a690505aa57 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -527,7 +527,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; } @@ -542,7 +542,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 7477bc757da..4b2f317ce37 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);