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
6d7c3825
Commit
6d7c3825
authored
Aug 25, 2011
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Aug 26, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Fix refcounting for the secondary buffer object.
This fixes a regression introduced in
6b64e009
.
parent
cb9fa1eb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
24 deletions
+43
-24
buffer.c
dlls/dsound/buffer.c
+34
-23
dsound_private.h
dlls/dsound/dsound_private.h
+2
-0
sound3d.c
dlls/dsound/sound3d.c
+7
-1
No files found.
dlls/dsound/buffer.c
View file @
6d7c3825
...
...
@@ -374,6 +374,10 @@ static ULONG WINAPI IDirectSoundBufferImpl_AddRef(IDirectSoundBuffer8 *iface)
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p) ref was %d
\n
"
,
This
,
ref
-
1
);
if
(
ref
==
1
)
InterlockedIncrement
(
&
This
->
numIfaces
);
return
ref
;
}
...
...
@@ -384,28 +388,9 @@ static ULONG WINAPI IDirectSoundBufferImpl_Release(IDirectSoundBuffer8 *iface)
TRACE
(
"(%p) ref was %d
\n
"
,
This
,
ref
+
1
);
if
(
!
ref
)
{
DirectSoundDevice_RemoveBuffer
(
This
->
device
,
This
);
RtlDeleteResource
(
&
This
->
lock
);
if
(
This
->
hwbuf
)
IDsDriverBuffer_Release
(
This
->
hwbuf
);
if
(
!
This
->
hwbuf
||
(
This
->
device
->
drvdesc
.
dwFlags
&
DSDDESC_USESYSTEMMEMORY
))
{
This
->
buffer
->
ref
--
;
list_remove
(
&
This
->
entry
);
if
(
This
->
buffer
->
ref
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
buffer
->
memory
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
buffer
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
This
->
tmp_buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
notifies
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pwfx
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
if
(
!
ref
&&
!
InterlockedDecrement
(
&
This
->
numIfaces
))
secondarybuffer_destroy
(
This
);
TRACE
(
"(%p) released
\n
"
,
This
);
}
return
ref
;
}
...
...
@@ -971,6 +956,7 @@ HRESULT IDirectSoundBufferImpl_Create(
TRACE
(
"Created buffer at %p
\n
"
,
dsb
);
dsb
->
ref
=
1
;
dsb
->
numIfaces
=
1
;
dsb
->
device
=
device
;
dsb
->
IDirectSoundBuffer8_iface
.
lpVtbl
=
&
dsbvt
;
dsb
->
iks
=
NULL
;
...
...
@@ -1123,6 +1109,30 @@ HRESULT IDirectSoundBufferImpl_Create(
return
err
;
}
void
secondarybuffer_destroy
(
IDirectSoundBufferImpl
*
This
)
{
DirectSoundDevice_RemoveBuffer
(
This
->
device
,
This
);
RtlDeleteResource
(
&
This
->
lock
);
if
(
This
->
hwbuf
)
IDsDriverBuffer_Release
(
This
->
hwbuf
);
if
(
!
This
->
hwbuf
||
(
This
->
device
->
drvdesc
.
dwFlags
&
DSDDESC_USESYSTEMMEMORY
))
{
This
->
buffer
->
ref
--
;
list_remove
(
&
This
->
entry
);
if
(
This
->
buffer
->
ref
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
buffer
->
memory
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
buffer
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
This
->
tmp_buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
notifies
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pwfx
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
TRACE
(
"(%p) released
\n
"
,
This
);
}
HRESULT
IDirectSoundBufferImpl_Destroy
(
IDirectSoundBufferImpl
*
pdsb
)
{
...
...
@@ -1130,7 +1140,7 @@ HRESULT IDirectSoundBufferImpl_Destroy(
/* This keeps the *_Destroy functions from possibly deleting
* this object until it is ready to be deleted */
I
DirectSoundBufferImpl_AddRef
(
&
pdsb
->
IDirectSoundBuffer8_iface
);
I
nterlockedIncrement
(
&
pdsb
->
numIfaces
);
if
(
pdsb
->
iks
)
{
WARN
(
"iks not NULL
\n
"
);
...
...
@@ -1150,7 +1160,7 @@ HRESULT IDirectSoundBufferImpl_Destroy(
pdsb
->
notify
=
NULL
;
}
while
(
IDirectSoundBuffer8_Release
(
&
pdsb
->
IDirectSoundBuffer8_iface
)
>
0
);
secondarybuffer_destroy
(
pdsb
);
return
S_OK
;
}
...
...
@@ -1196,6 +1206,7 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
dsb
->
buffer
->
ref
++
;
list_add_head
(
&
dsb
->
buffer
->
buffers
,
&
dsb
->
entry
);
dsb
->
ref
=
1
;
dsb
->
numIfaces
=
1
;
dsb
->
state
=
STATE_STOPPED
;
dsb
->
buf_mixpos
=
dsb
->
sec_mixpos
=
0
;
dsb
->
notify
=
NULL
;
...
...
dlls/dsound/dsound_private.h
View file @
6d7c3825
...
...
@@ -159,6 +159,7 @@ HRESULT DirectSoundDevice_VerifyCertification(DirectSoundDevice * device,
struct
IDirectSoundBufferImpl
{
IDirectSoundBuffer8
IDirectSoundBuffer8_iface
;
LONG
numIfaces
;
/* "in use interfaces" refcount */
LONG
ref
;
/* IDirectSoundBufferImpl fields */
DirectSoundDevice
*
device
;
...
...
@@ -206,6 +207,7 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
DirectSoundDevice
*
device
,
IDirectSoundBufferImpl
**
ppdsb
,
IDirectSoundBufferImpl
*
pdsb
)
DECLSPEC_HIDDEN
;
void
secondarybuffer_destroy
(
IDirectSoundBufferImpl
*
This
)
DECLSPEC_HIDDEN
;
/*****************************************************************************
* PrimaryBuffer implementation structure
...
...
dlls/dsound/sound3d.c
View file @
6d7c3825
...
...
@@ -335,7 +335,12 @@ static ULONG WINAPI IDirectSound3DBufferImpl_AddRef(LPDIRECTSOUND3DBUFFER iface)
{
IDirectSound3DBufferImpl
*
This
=
(
IDirectSound3DBufferImpl
*
)
iface
;
ULONG
ref
=
InterlockedIncrement
(
&
(
This
->
ref
));
TRACE
(
"(%p) ref was %d
\n
"
,
This
,
ref
-
1
);
if
(
ref
==
1
)
InterlockedIncrement
(
&
This
->
dsb
->
numIfaces
);
return
ref
;
}
...
...
@@ -347,7 +352,8 @@ static ULONG WINAPI IDirectSound3DBufferImpl_Release(LPDIRECTSOUND3DBUFFER iface
if
(
!
ref
)
{
This
->
dsb
->
ds3db
=
NULL
;
IDirectSoundBuffer_Release
((
LPDIRECTSOUNDBUFFER8
)
This
->
dsb
);
if
(
!
InterlockedDecrement
(
&
This
->
dsb
->
numIfaces
))
secondarybuffer_destroy
(
This
->
dsb
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
TRACE
(
"(%p) released
\n
"
,
This
);
}
...
...
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