Zebediah Figura (@zfigura) commented about dlls/winegstreamer/media_source.c:
static HRESULT WINAPI media_source_CreatePresentationDescriptor(IMFMediaSource *iface, IMFPresentationDescriptor **descriptor) { struct media_source *source = impl_from_IMFMediaSource(iface);
BOOL is_shutdown;
TRACE("%p, %p.\n", iface, descriptor);
- if (source->state == SOURCE_SHUTDOWN)
EnterCriticalSection(&source->cs);
is_shutdown = source->state == SOURCE_SHUTDOWN;
LeaveCriticalSection(&source->cs);
if (is_shutdown) return MF_E_SHUTDOWN;
return IMFPresentationDescriptor_Clone(source->pres_desc, descriptor);
This can still access an invalid presentation descriptor if the media source is concurrently shut down.
There are other, similar cases, e.g. in Start() and other state change methods, we can access an invalid command queue. In a sense this patch is really just protecting concurrent access to the "state" field, but I don't think that makes much sense by itself, especially given the nature of the problem we're trying to solve here.