Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
6d7c3825
Commit
6d7c3825
authored
13 years ago
by
Michael Stefaniuc
Committed by
Alexandre Julliard
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
dsound: Fix refcounting for the secondary buffer object.
This fixes a regression introduced in
6b64e009
.
parent
cb9fa1eb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dlls/dsound/buffer.c
+34
-23
34 additions, 23 deletions
dlls/dsound/buffer.c
dlls/dsound/dsound_private.h
+2
-0
2 additions, 0 deletions
dlls/dsound/dsound_private.h
dlls/dsound/sound3d.c
+7
-1
7 additions, 1 deletion
dlls/dsound/sound3d.c
with
43 additions
and
24 deletions
dlls/dsound/buffer.c
+
34
−
23
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_i
face
);
I
nterlockedIncrement
(
&
pdsb
->
numI
face
s
);
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
;
...
...
This diff is collapsed.
Click to expand it.
dlls/dsound/dsound_private.h
+
2
−
0
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
...
...
This diff is collapsed.
Click to expand it.
dlls/dsound/sound3d.c
+
7
−
1
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
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment