WMF: Fixed crash when cancelling media loading.

Since media loading is asynchronous, cancelling could cause a crash when
done after the media is loaded but the callback hasn't been called yet.

Change-Id: I9c9b7bfaa495b9e75765111c15afb07e8b699488
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
This commit is contained in:
Yoann Lopes
2012-12-11 17:13:26 +01:00
committed by The Qt Project
parent 3f84142aaa
commit 12bbd99047

View File

@@ -108,6 +108,10 @@ STDMETHODIMP_(ULONG) SourceResolver::Release(void)
HRESULT STDMETHODCALLTYPE SourceResolver::Invoke(IMFAsyncResult *pAsyncResult) HRESULT STDMETHODCALLTYPE SourceResolver::Invoke(IMFAsyncResult *pAsyncResult)
{ {
QMutexLocker locker(&m_mutex); QMutexLocker locker(&m_mutex);
if (!m_sourceResolver)
return S_OK;
MF_OBJECT_TYPE ObjectType = MF_OBJECT_INVALID; MF_OBJECT_TYPE ObjectType = MF_OBJECT_INVALID;
IUnknown* pSource = NULL; IUnknown* pSource = NULL;
State *state = static_cast<State*>(pAsyncResult->GetStateNoAddRef()); State *state = static_cast<State*>(pAsyncResult->GetStateNoAddRef());