[vlc-devel] [PATCH]: fix a CoInitializeEx() issue on Windows

Hugo Beauzée-Luyssen hugo at beauzee.fr
Fri Jul 12 15:34:16 CEST 2019


On Fri, Jul 12, 2019, at 2:53 PM, Steve Lhomme wrote:
> On 2019-07-12 14:32, Thomas Guillem wrote:
> > Hello,
> > 
> > OK for me.
> > 
> > Steve ?
> 
> I think you meant Hugo who's the one who has been playing with that.

I refute the usage of "playing" in this context :)

> 
> Anyway it seems correct. The CoInitializeEx() calls in our Qt code uses 
> COINIT_APARTMENTTHREADED.
> 

AFAIU, a thread doesn't belong to anything (with regard to the COM object concurrency mode) before the first call to CoInitializeEx. After that call, the thread is bound to that mode.

If this is to be called from the UI thread, then it needs to match what's done in the UI, or the UI changed the other way around, but I think Qt mandates APARTMENTTHREADED (which would match this remark from MSDN: «The multi-threaded apartment is intended for use by non-GUI threads. Threads in multi-threaded apartments should not perform UI actions.»)

However it seems CommonChangeThumbnailClip might still be called from the vout thread, and I fear that changing the object concurrency mode for the vout thread won't play well with SAPI, which is using MTA. I didn't find any requirement for SAPI to use COINIT_MULTITHREADED, so I suppose SAPI should be changed as well (unless I missed such a requirement, in which case I'm really not sure what to do here)

Regards,

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list