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
f54b0a5a
Commit
f54b0a5a
authored
Sep 15, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 18, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmusic: Keep an internal ref on the instrument's collection.
parent
82d1794c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
7 deletions
+31
-7
collection.c
dlls/dmusic/collection.c
+19
-2
dmusic_private.h
dlls/dmusic/dmusic_private.h
+5
-1
instrument.c
dlls/dmusic/instrument.c
+7
-4
No files found.
dlls/dmusic/collection.c
View file @
f54b0a5a
...
...
@@ -48,6 +48,7 @@ struct collection
{
IDirectMusicCollection
IDirectMusicCollection_iface
;
struct
dmobject
dmobj
;
LONG
internal_ref
;
LONG
ref
;
DLSHEADER
header
;
...
...
@@ -56,6 +57,21 @@ struct collection
struct
list
waves
;
};
extern
void
collection_internal_addref
(
struct
collection
*
collection
)
{
ULONG
ref
=
InterlockedIncrement
(
&
collection
->
internal_ref
);
TRACE
(
"collection %p, internal ref %lu.
\n
"
,
collection
,
ref
);
}
extern
void
collection_internal_release
(
struct
collection
*
collection
)
{
ULONG
ref
=
InterlockedDecrement
(
&
collection
->
internal_ref
);
TRACE
(
"collection %p, internal ref %lu.
\n
"
,
collection
,
ref
);
if
(
!
ref
)
free
(
collection
);
}
static
inline
struct
collection
*
impl_from_IDirectMusicCollection
(
IDirectMusicCollection
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
collection
,
IDirectMusicCollection_iface
);
...
...
@@ -128,7 +144,7 @@ static ULONG WINAPI collection_Release(IDirectMusicCollection *iface)
free
(
wave_entry
);
}
fre
e
(
This
);
collection_internal_releas
e
(
This
);
}
return
ref
;
...
...
@@ -201,7 +217,7 @@ static HRESULT parse_lins_list(struct collection *This, IStream *stream, struct
{
case
MAKE_IDTYPE
(
FOURCC_LIST
,
FOURCC_INS
):
if
(
!
(
entry
=
malloc
(
sizeof
(
*
entry
))))
return
E_OUTOFMEMORY
;
hr
=
instrument_create_from_chunk
(
stream
,
&
chunk
,
&
entry
->
desc
,
&
entry
->
instrument
);
hr
=
instrument_create_from_chunk
(
stream
,
&
chunk
,
This
,
&
entry
->
desc
,
&
entry
->
instrument
);
if
(
SUCCEEDED
(
hr
))
list_add_tail
(
&
This
->
instruments
,
&
entry
->
entry
);
else
free
(
entry
);
break
;
...
...
@@ -435,6 +451,7 @@ HRESULT collection_create(IUnknown **ret_iface)
*
ret_iface
=
NULL
;
if
(
!
(
collection
=
calloc
(
1
,
sizeof
(
*
collection
))))
return
E_OUTOFMEMORY
;
collection
->
IDirectMusicCollection_iface
.
lpVtbl
=
&
collection_vtbl
;
collection
->
internal_ref
=
1
;
collection
->
ref
=
1
;
dmobject_init
(
&
collection
->
dmobj
,
&
CLSID_DirectMusicCollection
,
(
IUnknown
*
)
&
collection
->
IDirectMusicCollection_iface
);
...
...
dlls/dmusic/dmusic_private.h
View file @
f54b0a5a
...
...
@@ -76,6 +76,10 @@ typedef struct port_info {
* ClassFactory
*/
struct
collection
;
extern
void
collection_internal_addref
(
struct
collection
*
collection
);
extern
void
collection_internal_release
(
struct
collection
*
collection
);
/* CLSID */
extern
HRESULT
music_create
(
IUnknown
**
ret_iface
);
extern
HRESULT
collection_create
(
IUnknown
**
ret_iface
);
...
...
@@ -87,7 +91,7 @@ extern HRESULT DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj,
extern
HRESULT
download_create
(
DWORD
size
,
IDirectMusicDownload
**
ret_iface
);
extern
HRESULT
instrument_create_from_chunk
(
IStream
*
stream
,
struct
chunk_entry
*
parent
,
DMUS_OBJECTDESC
*
desc
,
IDirectMusicInstrument
**
ret_iface
);
struct
collection
*
collection
,
DMUS_OBJECTDESC
*
desc
,
IDirectMusicInstrument
**
ret_iface
);
extern
HRESULT
instrument_download_to_port
(
IDirectMusicInstrument
*
iface
,
IDirectMusicPortDownload
*
port
,
IDirectMusicDownloadedInstrument
**
downloaded
);
extern
HRESULT
instrument_unload_from_port
(
IDirectMusicDownloadedInstrument
*
iface
,
IDirectMusicPortDownload
*
port
);
...
...
dlls/dmusic/instrument.c
View file @
f54b0a5a
...
...
@@ -51,6 +51,7 @@ struct instrument
INSTHEADER
header
;
IDirectMusicDownload
*
download
;
struct
collection
*
collection
;
struct
list
articulations
;
struct
list
regions
;
};
...
...
@@ -124,6 +125,7 @@ static ULONG WINAPI instrument_Release(LPDIRECTMUSICINSTRUMENT iface)
free
(
region
);
}
collection_internal_release
(
This
->
collection
);
free
(
This
);
}
...
...
@@ -201,7 +203,7 @@ static const IDirectMusicDownloadedInstrumentVtbl downloaded_instrument_vtbl =
downloaded_instrument_Release
,
};
static
HRESULT
instrument_create
(
IDirectMusicInstrument
**
ret_iface
)
static
HRESULT
instrument_create
(
struct
collection
*
collection
,
IDirectMusicInstrument
**
ret_iface
)
{
struct
instrument
*
instrument
;
...
...
@@ -210,6 +212,7 @@ static HRESULT instrument_create(IDirectMusicInstrument **ret_iface)
instrument
->
IDirectMusicInstrument_iface
.
lpVtbl
=
&
instrument_vtbl
;
instrument
->
IDirectMusicDownloadedInstrument_iface
.
lpVtbl
=
&
downloaded_instrument_vtbl
;
instrument
->
ref
=
1
;
collection_internal_addref
((
instrument
->
collection
=
collection
));
list_init
(
&
instrument
->
articulations
);
list_init
(
&
instrument
->
regions
);
...
...
@@ -377,15 +380,15 @@ static HRESULT parse_ins_chunk(struct instrument *This, IStream *stream, struct
}
HRESULT
instrument_create_from_chunk
(
IStream
*
stream
,
struct
chunk_entry
*
parent
,
DMUS_OBJECTDESC
*
desc
,
IDirectMusicInstrument
**
ret_iface
)
struct
collection
*
collection
,
DMUS_OBJECTDESC
*
desc
,
IDirectMusicInstrument
**
ret_iface
)
{
IDirectMusicInstrument
*
iface
;
struct
instrument
*
This
;
HRESULT
hr
;
TRACE
(
"(%p, %p
)
\n
"
,
stream
,
ret_iface
);
TRACE
(
"(%p, %p
, %p, %p, %p)
\n
"
,
stream
,
parent
,
collection
,
desc
,
ret_iface
);
if
(
FAILED
(
hr
=
instrument_create
(
&
iface
)))
return
hr
;
if
(
FAILED
(
hr
=
instrument_create
(
collection
,
&
iface
)))
return
hr
;
This
=
impl_from_IDirectMusicInstrument
(
iface
);
if
(
FAILED
(
hr
=
parse_ins_chunk
(
This
,
stream
,
parent
,
desc
)))
...
...
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