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
62bf2078
Commit
62bf2078
authored
May 12, 2017
by
Michael Stefaniuc
Committed by
Alexandre Julliard
May 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmusic: Remove the port from the ports list on the port destruction.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
bf10c558
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
2 deletions
+46
-2
dmusic.c
dlls/dmusic/dmusic.c
+37
-2
dmusic_private.h
dlls/dmusic/dmusic_private.h
+2
-0
port.c
dlls/dmusic/port.c
+1
-0
dmusic.c
dlls/dmusic/tests/dmusic.c
+6
-0
No files found.
dlls/dmusic/dmusic.c
View file @
62bf2078
...
...
@@ -160,9 +160,11 @@ static HRESULT WINAPI IDirectMusic8Impl_CreatePort(LPDIRECTMUSIC8 iface, REFCLSI
}
This
->
num_ports
++
;
if
(
!
This
->
ports
)
This
->
ports
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IDirectMusicPort
*
)
*
This
->
num_ports
);
This
->
ports
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
->
ports
)
*
This
->
num_ports
);
else
This
->
ports
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
This
->
ports
,
sizeof
(
IDirectMusicPort
*
)
*
This
->
num_ports
);
This
->
ports
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
This
->
ports
,
sizeof
(
*
This
->
ports
)
*
This
->
num_ports
);
This
->
ports
[
This
->
num_ports
-
1
]
=
new_port
;
*
port
=
new_port
;
return
S_OK
;
...
...
@@ -172,6 +174,39 @@ static HRESULT WINAPI IDirectMusic8Impl_CreatePort(LPDIRECTMUSIC8 iface, REFCLSI
return
E_NOINTERFACE
;
}
void
dmusic_remove_port
(
IDirectMusic8Impl
*
dmusic
,
IDirectMusicPort
*
port
)
{
BOOL
found
=
FALSE
;
int
i
;
TRACE
(
"Removing port %p.
\n
"
,
port
);
for
(
i
=
0
;
i
<
dmusic
->
num_ports
;
i
++
)
{
if
(
dmusic
->
ports
[
i
]
==
port
)
{
found
=
TRUE
;
break
;
}
}
if
(
!
found
)
{
ERR
(
"Port %p not found in ports array.
\n
"
,
port
);
return
;
}
if
(
!--
dmusic
->
num_ports
)
{
HeapFree
(
GetProcessHeap
(),
0
,
dmusic
->
ports
);
dmusic
->
ports
=
NULL
;
return
;
}
memmove
(
&
dmusic
->
ports
[
i
],
&
dmusic
->
ports
[
i
+
1
],
(
dmusic
->
num_ports
-
i
)
*
sizeof
(
*
dmusic
->
ports
));
dmusic
->
ports
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
dmusic
->
ports
,
sizeof
(
*
dmusic
->
ports
)
*
dmusic
->
num_ports
);
}
static
HRESULT
WINAPI
IDirectMusic8Impl_EnumMasterClock
(
LPDIRECTMUSIC8
iface
,
DWORD
index
,
LPDMUS_CLOCKINFO
clock_info
)
{
TRACE
(
"(%p)->(%d, %p)
\n
"
,
iface
,
index
,
clock_info
);
...
...
dlls/dmusic/dmusic_private.h
View file @
62bf2078
...
...
@@ -229,6 +229,8 @@ static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_ref
/*****************************************************************************
* Misc.
*/
void
dmusic_remove_port
(
IDirectMusic8Impl
*
dmusic
,
IDirectMusicPort
*
port
)
DECLSPEC_HIDDEN
;
/* for simpler reading */
typedef
struct
_DMUS_PRIVATE_CHUNK
{
FOURCC
fccID
;
/* FOURCC ID of the chunk */
...
...
dlls/dmusic/port.c
View file @
62bf2078
...
...
@@ -194,6 +194,7 @@ static ULONG WINAPI SynthPortImpl_IDirectMusicPort_Release(LPDIRECTMUSICPORT ifa
if
(
!
ref
)
{
dmusic_remove_port
(
This
->
parent
,
iface
);
IDirectMusicSynth_Activate
(
This
->
synth
,
FALSE
);
IDirectMusicSynth_Close
(
This
->
synth
);
IDirectMusicSynth_Release
(
This
->
synth
);
...
...
dlls/dmusic/tests/dmusic.c
View file @
62bf2078
...
...
@@ -176,10 +176,16 @@ static void test_setdsound(void)
ok
(
hr
==
S_OK
,
"CreatePort returned: %x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
IDirectMusicPort_AddRef
(
port
);
ref
=
IDirectMusicPort_Release
(
port
);
ok
(
ref
==
1
,
"port ref count got %d expected 1
\n
"
,
ref
);
hr
=
IDirectMusicPort_Activate
(
port
,
TRUE
);
ok
(
hr
==
S_OK
,
"Port Activate returned: %x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
ok
(
ref
==
4
,
"dsound ref count got %d expected 4
\n
"
,
ref
);
IDirectMusicPort_AddRef
(
port
);
ref
=
IDirectMusicPort_Release
(
port
);
ok
(
ref
==
1
,
"port ref count got %d expected 1
\n
"
,
ref
);
/* Releasing dsound from dmusic */
hr
=
IDirectMusic_SetDirectSound
(
dmusic
,
NULL
,
NULL
);
...
...
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