Commit a5189756 authored by Gijs Vermeulen's avatar Gijs Vermeulen Committed by Alexandre Julliard

amstream: Increase parent IAMMediaStream refcount in IDirectDrawMediaStream::CreateSample().

parent a4ddb5a1
......@@ -1048,6 +1048,8 @@ static ULONG WINAPI ddraw_sample_Release(IDirectDrawStreamSample *iface)
--sample->parent->sample_refs;
LeaveCriticalSection(&sample->parent->cs);
IAMMediaStream_Release(&sample->parent->IAMMediaStream_iface);
if (sample->surface)
IDirectDrawSurface_Release(sample->surface);
HeapFree(GetProcessHeap(), 0, sample);
......@@ -1163,6 +1165,7 @@ static HRESULT ddrawstreamsample_create(struct ddraw_stream *parent, IDirectDraw
object->IDirectDrawStreamSample_iface.lpVtbl = &DirectDrawStreamSample_Vtbl;
object->ref = 1;
object->parent = parent;
IAMMediaStream_AddRef(&parent->IAMMediaStream_iface);
++parent->sample_refs;
if (surface)
......
......@@ -5670,7 +5670,7 @@ static void test_ddrawstream_create_sample(void)
EXPECT_REF(stream, 3);
hr = IDirectDrawMediaStream_CreateSample(ddraw_stream, NULL, NULL, 0, &sample);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine EXPECT_REF(stream, 4);
EXPECT_REF(stream, 4);
hr = IDirectDrawStreamSample_GetSurface(sample, NULL, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
......@@ -5773,13 +5773,13 @@ static void test_ddrawstreamsample_get_media_stream(void)
ok(hr == E_POINTER, "Got hr %#x.\n", hr);
}
todo_wine EXPECT_REF(stream, 4);
EXPECT_REF(stream, 4);
hr = IDirectDrawStreamSample_GetMediaStream(sample, &stream2);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(stream2 == stream, "Expected stream %p, got %p.\n", stream, stream2);
todo_wine EXPECT_REF(stream, 5);
EXPECT_REF(stream, 5);
IMediaStream_Release(stream2);
todo_wine EXPECT_REF(stream, 4);
EXPECT_REF(stream, 4);
IDirectDrawMediaStream_Release(ddraw_stream);
ref = IDirectDrawStreamSample_Release(sample);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment