mft: fix probe issue with GUI threads

The skins2 thread as a Gui interface uses OLE/COM set up as 'appartment threaded' for DragNDrop. This thread also uses the vlc decoding facilities to decode still images and therefore is likely to probe decoder modules.

Calling CoInitializeEx() in multithreaded mode is not compatible with the already 'appartment threaded' setting, and therefore fails. In debug mode, this causes an unreachable assert. In non debug mode, the Open() is executed, fails and calls an undue CoUninitialize() which silently breaks the whole OLE setting of the thread.

The patch just gracefully returns on failure.

(cherry picked from commit 545124d374)
Signed-off-by: Erwan Tulou <erwan10@videolan.org>
This commit is contained in:
Erwan Tulou 2018-01-20 20:49:56 +01:00
parent 7a12364069
commit 8719301547
1 changed files with 4 additions and 1 deletions

View File

@ -1121,7 +1121,10 @@ static int Open(vlc_object_t *p_this)
return VLC_ENOMEM;
if( FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED)) )
vlc_assert_unreachable();
{
free(p_sys);
return VLC_EGENERIC;
}
if (LoadMFTLibrary(&p_sys->mf_handle))
{