qasf/dmowrapper: Don't crash in ::Stop when DMO wrapper is not initialized.

Signed-off-by: Anton Baskanov <baskanov@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Anton Baskanov 2020-06-25 22:21:09 +07:00 committed by Alexandre Julliard
parent e285c6e929
commit 3667754aa2
2 changed files with 21 additions and 0 deletions

View file

@ -673,6 +673,9 @@ static HRESULT dmo_wrapper_cleanup_stream(struct strmbase_filter *iface)
IMediaObject *dmo;
DWORD i;
if (!filter->dmo)
return E_FAIL;
IUnknown_QueryInterface(filter->dmo, &IID_IMediaObject, (void **)&dmo);
for (i = 0; i < filter->source_count; ++i)

View file

@ -1995,6 +1995,23 @@ static void test_connect_pin(void)
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
static void test_uninitialized(void)
{
IBaseFilter *filter = NULL;
HRESULT hr;
ULONG ref;
hr = CoCreateInstance(&CLSID_DMOWrapperFilter, NULL,
CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_Stop(filter);
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
ref = IBaseFilter_Release(filter);
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
START_TEST(dmowrapper)
{
DWORD cookie;
@ -2022,6 +2039,7 @@ START_TEST(dmowrapper)
test_media_types();
test_enum_media_types();
test_connect_pin();
test_uninitialized();
CoRevokeClassObject(cookie);
DMOUnregister(&testdmo_clsid, &DMOCATEGORY_AUDIO_DECODER);