dsound: Avoid casts from COM object to interface.
Andrew Eikum
aeikum at codeweavers.com
Fri Dec 9 08:35:35 CST 2016
On Thu, Dec 08, 2016 at 11:29:42AM +0100, Michael Stefaniuc wrote:
> Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
> ---
> dlls/dsound/dsound.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c
> index 43b252d..d11c864 100644
> --- a/dlls/dsound/dsound.c
> +++ b/dlls/dsound/dsound.c
> @@ -452,8 +452,8 @@ static HRESULT DirectSoundDevice_CreateSoundBuffer(
>
> if (device->primary) {
> WARN("Primary Buffer already created\n");
> - IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER8)(device->primary));
> - *ppdsb = (LPDIRECTSOUNDBUFFER)(device->primary);
> + *ppdsb = (IDirectSoundBuffer *)&device->primary->IDirectSoundBuffer8_iface;
> + IDirectSoundBuffer_AddRef(*ppdsb);
> } else {
Changing the order of these statements makes me nervous. Some
applications use the returned pointers before the function returns,
see 6a7c2f66e0569d2419eb9619e78716a9a5f94966.
Andrew
More information about the wine-devel
mailing list