Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
5fa11f5f
Commit
5fa11f5f
authored
Jan 22, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Jan 26, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Keep an internal refcount for dinput devices references.
parent
27e89c5c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
12 deletions
+30
-12
device.c
dlls/dinput/device.c
+2
-3
dinput.c
dlls/dinput/dinput.c
+24
-6
dinput_private.h
dlls/dinput/dinput_private.h
+4
-0
device8.c
dlls/dinput/tests/device8.c
+0
-1
hid.c
dlls/dinput/tests/hid.c
+0
-2
No files found.
dlls/dinput/device.c
View file @
5fa11f5f
...
...
@@ -716,7 +716,7 @@ void dinput_device_internal_release( struct dinput_device *impl )
free
(
impl
->
action_map
);
IDirectInput_Release
(
&
impl
->
dinput
->
IDirectInput7A_iface
);
dinput_internal_release
(
impl
->
dinput
);
impl
->
crit
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
impl
->
crit
);
...
...
@@ -2125,8 +2125,7 @@ void dinput_device_init( struct dinput_device *device, const struct dinput_devic
device
->
device_gain
=
10000
;
device
->
force_feedback_state
=
DIGFFS_STOPPED
|
DIGFFS_EMPTY
;
InitializeCriticalSection
(
&
device
->
crit
);
device
->
dinput
=
dinput
;
IDirectInput_AddRef
(
&
dinput
->
IDirectInput7A_iface
);
dinput_internal_addref
(
(
device
->
dinput
=
dinput
)
);
device
->
vtbl
=
vtbl
;
}
...
...
dlls/dinput/dinput.c
View file @
5fa11f5f
...
...
@@ -107,6 +107,28 @@ static HRESULT WINAPI dinput7_EnumDevices( IDirectInput7W *iface, DWORD type, LP
return
IDirectInput8_EnumDevices
(
&
impl
->
IDirectInput8W_iface
,
type
,
callback
,
context
,
flags
);
}
void
dinput_internal_addref
(
struct
dinput
*
impl
)
{
ULONG
ref
=
InterlockedIncrement
(
&
impl
->
internal_ref
);
TRACE
(
"impl %p, internal ref %lu.
\n
"
,
impl
,
ref
);
}
void
dinput_internal_release
(
struct
dinput
*
impl
)
{
ULONG
ref
=
InterlockedDecrement
(
&
impl
->
internal_ref
);
TRACE
(
"impl %p, internal ref %lu.
\n
"
,
impl
,
ref
);
if
(
!
ref
)
{
struct
DevicePlayer
*
device_player
,
*
device_player2
;
LIST_FOR_EACH_ENTRY_SAFE
(
device_player
,
device_player2
,
&
impl
->
device_players
,
struct
DevicePlayer
,
entry
)
free
(
device_player
);
free
(
impl
);
}
}
static
ULONG
WINAPI
dinput7_AddRef
(
IDirectInput7W
*
iface
)
{
struct
dinput
*
impl
=
impl_from_IDirectInput7W
(
iface
);
...
...
@@ -124,12 +146,7 @@ static ULONG WINAPI dinput7_Release( IDirectInput7W *iface )
if
(
!
ref
)
{
struct
DevicePlayer
*
device_player
,
*
device_player2
;
LIST_FOR_EACH_ENTRY_SAFE
(
device_player
,
device_player2
,
&
impl
->
device_players
,
struct
DevicePlayer
,
entry
)
free
(
device_player
);
free
(
impl
);
dinput_internal_release
(
impl
);
}
return
ref
;
...
...
@@ -792,6 +809,7 @@ static HRESULT dinput_create( IUnknown **out )
impl
->
IDirectInput8A_iface
.
lpVtbl
=
&
dinput8_a_vtbl
;
impl
->
IDirectInput8W_iface
.
lpVtbl
=
&
dinput8_vtbl
;
impl
->
IDirectInputJoyConfig8_iface
.
lpVtbl
=
&
joy_config_vtbl
;
impl
->
internal_ref
=
1
;
impl
->
ref
=
1
;
list_init
(
&
impl
->
device_players
);
...
...
dlls/dinput/dinput_private.h
View file @
5fa11f5f
...
...
@@ -36,6 +36,7 @@ struct dinput
IDirectInput8A
IDirectInput8A_iface
;
IDirectInput8W
IDirectInput8W_iface
;
IDirectInputJoyConfig8
IDirectInputJoyConfig8_iface
;
LONG
internal_ref
;
LONG
ref
;
DWORD
dwVersion
;
/* direct input version number */
...
...
@@ -46,6 +47,9 @@ struct dinput
extern
const
IDirectInput7AVtbl
dinput7_a_vtbl
DECLSPEC_HIDDEN
;
extern
const
IDirectInput8AVtbl
dinput8_a_vtbl
DECLSPEC_HIDDEN
;
extern
void
dinput_internal_addref
(
struct
dinput
*
dinput
);
extern
void
dinput_internal_release
(
struct
dinput
*
dinput
);
extern
HRESULT
mouse_enum_device
(
DWORD
type
,
DWORD
flags
,
DIDEVICEINSTANCEW
*
instance
,
DWORD
version
);
extern
HRESULT
mouse_create_device
(
struct
dinput
*
dinput
,
const
GUID
*
guid
,
IDirectInputDevice8W
**
out
);
extern
HRESULT
keyboard_enum_device
(
DWORD
type
,
DWORD
flags
,
DIDEVICEINSTANCEW
*
instance
,
DWORD
version
);
...
...
dlls/dinput/tests/device8.c
View file @
5fa11f5f
...
...
@@ -116,7 +116,6 @@ static HRESULT create_dinput_device( DWORD version, const GUID *guid, IDirectInp
ok
(
hr
==
DI_OK
,
"CreateDevice returned %#lx
\n
"
,
hr
);
ref
=
IDirectInput_Release
(
dinput
);
todo_wine
ok
(
ref
==
0
,
"Release returned %ld
\n
"
,
ref
);
return
DI_OK
;
...
...
dlls/dinput/tests/hid.c
View file @
5fa11f5f
...
...
@@ -3689,7 +3689,6 @@ HRESULT dinput_test_create_device( DWORD version, DIDEVICEINSTANCEW *devinst, ID
ok
(
hr
==
DI_OK
,
"CreateDevice returned %#lx
\n
"
,
hr
);
ref
=
IDirectInput8_Release
(
di8
);
todo_wine
ok
(
ref
==
0
,
"Release returned %ld
\n
"
,
ref
);
}
else
...
...
@@ -3716,7 +3715,6 @@ HRESULT dinput_test_create_device( DWORD version, DIDEVICEINSTANCEW *devinst, ID
ok
(
hr
==
DI_OK
,
"CreateDevice returned %#lx
\n
"
,
hr
);
ref
=
IDirectInput_Release
(
di
);
todo_wine
ok
(
ref
==
0
,
"Release returned %ld
\n
"
,
ref
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment