evr/presenter: Fix a crash when releasing partially initialized object.

This happens when presenter is unable to create d3d device.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-10-29 15:30:26 +03:00 committed by Alexandre Julliard
parent 8c0c3d296f
commit 3c1a02eb97
1 changed files with 8 additions and 2 deletions

View File

@ -267,8 +267,11 @@ static void video_presenter_reset_media_type(struct video_presenter *presenter)
IMFMediaType_Release(presenter->media_type);
presenter->media_type = NULL;
IMFVideoSampleAllocator_UninitializeSampleAllocator(presenter->allocator);
video_presenter_set_allocator_callback(presenter, NULL);
if (presenter->allocator)
{
IMFVideoSampleAllocator_UninitializeSampleAllocator(presenter->allocator);
video_presenter_set_allocator_callback(presenter, NULL);
}
}
static HRESULT video_presenter_set_media_type(struct video_presenter *presenter, IMFMediaType *media_type)
@ -2083,7 +2086,10 @@ HRESULT evr_presenter_create(IUnknown *outer, void **out)
goto failed;
if (FAILED(hr = video_presenter_init_d3d(object)))
{
WARN("Failed to initialize d3d device, hr %#x.\n", hr);
goto failed;
}
*out = &object->IUnknown_inner;