Fix use-after-free in AVFCameraService during renderer destruction

Change-Id: I10a994b71e55565c0de31aa0c34f32964e2e3a1b
Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
This commit is contained in:
John Brooks
2015-11-06 14:15:57 -08:00
committed by John Brooks
parent b80436a3e0
commit 5c09c4c3c7

View File

@@ -203,18 +203,15 @@ QMediaControl *AVFCameraService::requestControl(const char *name)
void AVFCameraService::releaseControl(QMediaControl *control) void AVFCameraService::releaseControl(QMediaControl *control)
{ {
if (m_videoOutput == control) {
m_session->setVideoOutput(0);
delete m_videoOutput;
m_videoOutput = 0;
}
AVFMediaVideoProbeControl *videoProbe = qobject_cast<AVFMediaVideoProbeControl *>(control); AVFMediaVideoProbeControl *videoProbe = qobject_cast<AVFMediaVideoProbeControl *>(control);
if (videoProbe) { if (videoProbe) {
m_session->removeProbe(videoProbe); m_session->removeProbe(videoProbe);
delete videoProbe; delete videoProbe;
return; } else if (m_videoOutput == control) {
m_session->setVideoOutput(0);
delete m_videoOutput;
m_videoOutput = 0;
} }
} }
AVFMediaRecorderControl *AVFCameraService::recorderControl() const AVFMediaRecorderControl *AVFCameraService::recorderControl() const