[PATCH 1/2] amstream: Increment/decrement IMediaStreamFilter refcount twice in multimedia_stream_create/release().
Zebediah Figura
z.figura12 at gmail.com
Mon Jul 6 10:03:09 CDT 2020
On 7/4/20 5:30 AM, Gijs Vermeulen wrote:
> Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
> ---
> dlls/amstream/multimedia.c | 7 ++++++-
> dlls/amstream/tests/amstream.c | 8 ++++----
> 2 files changed, 10 insertions(+), 5 deletions(-)
I think this behaviour is weird enough to deserve a comment in the code.
>
> diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c
> index e058e639dd..56512d19da 100644
> --- a/dlls/amstream/multimedia.c
> +++ b/dlls/amstream/multimedia.c
> @@ -91,7 +91,11 @@ static ULONG WINAPI multimedia_stream_Release(IAMMultiMediaStream *iface)
> {
> if (This->ipin)
> IPin_Release(This->ipin);
> - IMediaStreamFilter_Release(This->filter);
> + if (This->filter)
> + {
> + IMediaStreamFilter_Release(This->filter);
> + IMediaStreamFilter_Release(This->filter);
> + }
You shouldn't have to check for the validity of This->filter; it's
created along with the object.
> if (This->media_seeking)
> IMediaSeeking_Release(This->media_seeking);
> if (This->media_control)
> @@ -519,6 +523,7 @@ HRESULT multimedia_stream_create(IUnknown *outer, void **out)
> }
>
> TRACE("Created multimedia stream %p.\n", object);
> + IMediaStreamFilter_AddRef(object->filter);
> *out = &object->IAMMultiMediaStream_iface;
>
> return S_OK;
> diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
> index 3fb77f277a..7ebd54f6da 100644
> --- a/dlls/amstream/tests/amstream.c
> +++ b/dlls/amstream/tests/amstream.c
> @@ -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);
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200706/84a8dc8e/attachment-0001.sig>
More information about the wine-devel
mailing list