Rémi Bernon : dinput: Set HID joystick internal ref before trying to open it.
Alexandre Julliard
julliard at winehq.org
Wed Feb 16 15:30:26 CST 2022
Module: wine
Branch: master
Commit: cd6bab2b2a49612583cdd7aa32012f5077ec0d5c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=cd6bab2b2a49612583cdd7aa32012f5077ec0d5c
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Wed Feb 16 09:26:57 2022 +0100
dinput: Set HID joystick internal ref before trying to open it.
So that an open failure will not decrement it to -1.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dinput/joystick_hid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index b9542d37f9b..47670ebd732 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -2013,12 +2013,12 @@ HRESULT hid_joystick_create_device( struct dinput *dinput, const GUID *guid, IDi
impl->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": hid_joystick.base.crit");
impl->base.dwCoopLevel = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND;
impl->base.read_event = CreateEventW( NULL, TRUE, FALSE, NULL );
+ impl->internal_ref = 1;
hr = hid_joystick_device_open( -1, &instance, impl->device_path, &impl->device, &impl->preparsed,
&attrs, &impl->caps, dinput->dwVersion );
if (hr != DI_OK) goto failed;
- impl->internal_ref = 1;
impl->base.instance = instance;
impl->base.caps.dwDevType = instance.dwDevType;
impl->attrs = attrs;
More information about the wine-cvs
mailing list