amstream: Increment/decrement IMediaStreamFilter refcount twice in multimedia_stream_create/release().

Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gijs Vermeulen 2020-07-06 17:42:47 +02:00 committed by Alexandre Julliard
parent b116cf848a
commit f446bb21f2
2 changed files with 8 additions and 4 deletions

View File

@ -92,6 +92,7 @@ static ULONG WINAPI multimedia_stream_Release(IAMMultiMediaStream *iface)
if (This->ipin)
IPin_Release(This->ipin);
IMediaStreamFilter_Release(This->filter);
IMediaStreamFilter_Release(This->filter);
if (This->media_seeking)
IMediaSeeking_Release(This->media_seeking);
if (This->media_control)
@ -518,6 +519,9 @@ HRESULT multimedia_stream_create(IUnknown *outer, void **out)
return hr;
}
/* The stream takes an additional reference to the filter. */
IMediaStreamFilter_AddRef(object->filter);
TRACE("Created multimedia stream %p.\n", object);
*out = &object->IAMMultiMediaStream_iface;

View File

@ -1140,7 +1140,7 @@ static void test_enum_pins(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
ref = get_refcount(filter);
todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref);
ok(ref == 3, "Got unexpected refcount %d.\n", ref);
hr = IMediaStreamFilter_EnumPins(filter, NULL);
ok(hr == E_POINTER, "Got hr %#x.\n", hr);
@ -1148,7 +1148,7 @@ static void test_enum_pins(void)
hr = IMediaStreamFilter_EnumPins(filter, &enum1);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ref = get_refcount(filter);
todo_wine ok(ref == 3, "Got unexpected refcount %d.\n", ref);
ok(ref == 3, "Got unexpected refcount %d.\n", ref);
ref = get_refcount(enum1);
ok(ref == 1, "Got unexpected refcount %d.\n", ref);
@ -1186,7 +1186,7 @@ static void test_enum_pins(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
ref = get_refcount(filter);
todo_wine ok(ref == 4, "Got unexpected refcount %d.\n", ref);
ok(ref == 4, "Got unexpected refcount %d.\n", ref);
ref = get_refcount(enum1);
ok(ref == 1, "Got unexpected refcount %d.\n", ref);
ref = get_refcount(pin);
@ -1196,7 +1196,7 @@ static void test_enum_pins(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(pins[0] == pin, "Expected pin %p, got %p.\n", pin, pins[0]);
ref = get_refcount(filter);
todo_wine ok(ref == 4, "Got unexpected refcount %d.\n", ref);
ok(ref == 4, "Got unexpected refcount %d.\n", ref);
ref = get_refcount(enum1);
ok(ref == 1, "Got unexpected refcount %d.\n", ref);
ref = get_refcount(pin);