WMF: fix crash on media player destruction.
A race condition could cause a frame to be presented even after the QAbstractVideoSurface was deleted. We now check that the surface is valid before presenting a frame. Task-number: QTBUG-41158 Change-Id: If593469a8267583e499e781336af38d3fbf318fd Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
@@ -330,6 +330,7 @@ void D3DPresentEngine::presentSample(void *opaque, qint64)
|
||||
IMFMediaBuffer* buffer = NULL;
|
||||
IDirect3DSurface9* surface = NULL;
|
||||
|
||||
if (m_surface && m_surface->isActive()) {
|
||||
if (sample) {
|
||||
// Get the buffer from the sample.
|
||||
hr = sample->GetBufferByIndex(0, &buffer);
|
||||
@@ -359,6 +360,7 @@ void D3DPresentEngine::presentSample(void *opaque, qint64)
|
||||
|
||||
m_surface->present(frame);
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
qt_wmf_safeRelease(&surface);
|
||||
|
||||
Reference in New Issue
Block a user