Fix some surface assignment errors.

On destruction and changing sources, make sure we don't clobber the
surface property if it's been changed.

Change-Id: I3080b98a547911543a391c8bc040792d260782fd
Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
This commit is contained in:
Michael Goddard
2012-01-27 12:38:35 +10:00
committed by Qt by Nokia
parent bad94a5329
commit 88431b2841
2 changed files with 30 additions and 5 deletions

View File

@@ -178,6 +178,11 @@ QDeclarativeVideoOutput::QDeclarativeVideoOutput(QQuickItem *parent) :
QDeclarativeVideoOutput::~QDeclarativeVideoOutput()
{
if (m_source && m_sourceType == VideoSurfaceSource) {
if (m_source.data()->property("videoSurface").value<QAbstractVideoSurface*>() == m_surface)
m_source.data()->setProperty("videoSurface", QVariant::fromValue<QAbstractVideoSurface*>(0));
}
m_source.clear();
_q_updateMediaObject();
delete m_surface;
@@ -209,8 +214,10 @@ void QDeclarativeVideoOutput::setSource(QObject *source)
if (m_source && m_sourceType == MediaObjectSource)
disconnect(0, m_source.data(), SLOT(_q_updateMediaObject()));
if (m_source && m_sourceType == VideoSurfaceSource)
m_source.data()->setProperty("videoSurface", QVariant::fromValue<QAbstractVideoSurface*>(0));
if (m_source && m_sourceType == VideoSurfaceSource) {
if (m_source.data()->property("videoSurface").value<QAbstractVideoSurface*>() == m_surface)
m_source.data()->setProperty("videoSurface", QVariant::fromValue<QAbstractVideoSurface*>(0));
}
m_surface->stop();