[PATCH 3/4] dmime: Initialize dmusic in InitAudio()

Michael Stefaniuc mstefani at winehq.org
Fri May 12 09:11:24 CDT 2017


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/dmime/performance.c       | 9 ++++++++-
 dlls/dmime/tests/performance.c | 6 +++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c
index d0df2d5..6e4dae6 100644
--- a/dlls/dmime/performance.c
+++ b/dlls/dmime/performance.c
@@ -802,6 +802,7 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CloseDown(IDirectMusicPerform
         This->dsound = NULL;
     }
     if (This->dmusic) {
+        IDirectMusic_SetDirectSound(This->dmusic, NULL, NULL);
         IDirectMusic8_Release(This->dmusic);
         This->dmusic = NULL;
     }
@@ -895,6 +896,10 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_InitAudio(IDirectMusicPerform
         IDirectSound_AddRef(This->dsound);
     }
 
+    hr = IDirectMusic8_SetDirectSound(This->dmusic, This->dsound, NULL);
+    if (FAILED(hr))
+        goto error;
+
     if (!params) {
         This->params.dwSize = sizeof(DMUS_AUDIOPARAMS);
         This->params.fInitNow = FALSE;
@@ -910,8 +915,10 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_InitAudio(IDirectMusicPerform
     if (default_path_type) {
         hr = IDirectMusicPerformance8_CreateStandardAudioPath(iface, default_path_type,
                 num_channels, FALSE, &This->pDefaultPath);
-        if (FAILED(hr))
+        if (FAILED(hr)) {
+            IDirectMusic8_SetDirectSound(This->dmusic, NULL, NULL);
             goto error;
+        }
     }
 
     if (dsound && !*dsound) {
diff --git a/dlls/dmime/tests/performance.c b/dlls/dmime/tests/performance.c
index 9187c81..c4cbb32 100644
--- a/dlls/dmime/tests/performance.c
+++ b/dlls/dmime/tests/performance.c
@@ -129,7 +129,7 @@ static HRESULT test_InitAudio(void)
     hr = IDirectMusicPerformance8_InitAudio(performance, &dmusic, &dsound, NULL, 0, 64, 0, NULL);
     ok(hr == S_OK, "InitAudio failed: %08x\n", hr);
     ref = get_refcount(dsound);
-    todo_wine ok(ref == 3, "dsound ref count got %d expected 3\n", ref);
+    ok(ref == 3, "dsound ref count got %d expected 3\n", ref);
     ref = get_refcount(dmusic);
     ok(ref == 2, "dmusic ref count got %d expected 2\n", ref);
     destroy_performance(performance, NULL, NULL);
@@ -171,7 +171,7 @@ static HRESULT test_InitAudio(void)
     hr = IDirectMusicPerformance8_InitAudio(performance, &dmusic, &dsound, NULL, 0, 64, 0, NULL);
     ok(hr == S_OK, "InitAudio failed: %08x\n", hr);
     ref = get_refcount(dsound);
-    ok(ref == 2, "dsound ref count got %d expected 2\n", ref);
+    todo_wine ok(ref == 2, "dsound ref count got %d expected 2\n", ref);
     ref = get_refcount(dmusic);
     ok(ref == 2, "dmusic ref count got %d expected 2\n", ref);
     destroy_performance(performance, dmusic, dsound);
@@ -185,7 +185,7 @@ static HRESULT test_InitAudio(void)
     hr = IDirectMusicPerformance8_InitAudio(performance, &dmusic, NULL, NULL, 0, 64, 0, NULL);
     ok(hr == S_OK, "InitAudio failed: %08x\n", hr);
     ref = get_refcount(dsound);
-    ok(ref == 2, "dsound ref count got %d expected 2\n", ref);
+    todo_wine ok(ref == 2, "dsound ref count got %d expected 2\n", ref);
     ref = get_refcount(dmusic);
     ok(ref == 2, "dmusic ref count got %d expected 2\n", ref);
     destroy_performance(performance, dmusic, dsound);
-- 
2.9.3




More information about the wine-patches mailing list