summaryrefslogtreecommitdiffstats
path: root/src/3rdparty
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-06-08 10:30:05 (GMT)
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-07-07 12:19:31 (GMT)
commit0c71b098965ce4779a7da785249497c15b9d1d14 (patch)
treede2dd5a90b6282400938c3135f1e6d65e8e2bdbe /src/3rdparty
parente7f6c2d9625bda1d063b9ec3acd7eb5f79f30ba7 (diff)
downloadQt-0c71b098965ce4779a7da785249497c15b9d1d14.zip
Qt-0c71b098965ce4779a7da785249497c15b9d1d14.tar.gz
Qt-0c71b098965ce4779a7da785249497c15b9d1d14.tar.bz2
Prevent crash when video is played without a VideoWidget
The Phonon API allows video to be played via a Phonon::MediaObject, even if no Phonon::VideoWidget has been connected to it. This patch prevents the Phonon MMF backend crashing in this scenario due to dereferencing a null pointer. Reviewed-by: Thierry Bastian
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/phonon/mmf/abstractvideoplayer.cpp10
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer_dsa.cpp7
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer_surface.cpp5
3 files changed, 18 insertions, 4 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp
index 2e0ab1c..ecfce9e 100644
--- a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp
+++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp
@@ -211,7 +211,8 @@ void MMF::AbstractVideoPlayer::aspectRatioChanged()
TRACE_CONTEXT(AbstractVideoPlayer::aspectRatioChanged, EVideoInternal);
TRACE_ENTRY("state %d aspectRatio %d", state());
- updateScaleFactors(m_videoOutput->videoWindowSize());
+ if (m_videoOutput)
+ updateScaleFactors(m_videoOutput->videoWindowSize());
TRACE_EXIT_0();
}
@@ -221,7 +222,8 @@ void MMF::AbstractVideoPlayer::scaleModeChanged()
TRACE_CONTEXT(AbstractVideoPlayer::scaleModeChanged, EVideoInternal);
TRACE_ENTRY("state %d", state());
- updateScaleFactors(m_videoOutput->videoWindowSize());
+ if (m_videoOutput)
+ updateScaleFactors(m_videoOutput->videoWindowSize());
TRACE_EXIT_0();
}
@@ -357,6 +359,8 @@ void MMF::AbstractVideoPlayer::videoOutputChanged()
void MMF::AbstractVideoPlayer::initVideoOutput()
{
+ Q_ASSERT(m_videoOutput);
+
bool connected = connect(
m_videoOutput, SIGNAL(videoWindowChanged()),
this, SLOT(videoWindowChanged())
@@ -400,6 +404,8 @@ QSize scaleToAspect(const QSize &srcRect, int aspectWidth, int aspectHeight)
void MMF::AbstractVideoPlayer::updateScaleFactors(const QSize &windowSize, bool apply)
{
+ Q_ASSERT(m_videoOutput);
+
if (m_videoFrameSize.isValid()) {
QRect videoRect;
diff --git a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp
index 1925471..f0255b1 100644
--- a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp
+++ b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp
@@ -61,6 +61,8 @@ DsaVideoPlayer::~DsaVideoPlayer()
void MMF::DsaVideoPlayer::videoWindowScreenRectChanged()
{
+ Q_ASSERT(m_videoOutput);
+
QRect windowRect = static_cast<DsaVideoOutput *>(m_videoOutput)->videoWindowScreenRect();
// Clip to physical window size
@@ -130,6 +132,8 @@ void MMF::DsaVideoPlayer::createPlayer()
void MMF::DsaVideoPlayer::initVideoOutput()
{
+ Q_ASSERT(m_videoOutput);
+
bool connected = connect(
m_videoOutput, SIGNAL(videoWindowScreenRectChanged()),
this, SLOT(videoWindowScreenRectChanged())
@@ -156,7 +160,8 @@ void MMF::DsaVideoPlayer::initVideoOutput()
void MMF::DsaVideoPlayer::prepareCompleted()
{
- videoWindowScreenRectChanged();
+ if (m_videoOutput)
+ videoWindowScreenRectChanged();
}
void MMF::DsaVideoPlayer::handleVideoWindowChanged()
diff --git a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp
index fda7342..5d8db26 100644
--- a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp
+++ b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp
@@ -59,7 +59,8 @@ SurfaceVideoPlayer::~SurfaceVideoPlayer()
void MMF::SurfaceVideoPlayer::videoWindowSizeChanged()
{
- updateScaleFactors(m_videoOutput->videoWindowSize());
+ if (m_videoOutput)
+ updateScaleFactors(m_videoOutput->videoWindowSize());
}
@@ -80,6 +81,8 @@ void MMF::SurfaceVideoPlayer::createPlayer()
void MMF::SurfaceVideoPlayer::initVideoOutput()
{
+ Q_ASSERT(m_videoOutput);
+
bool connected = connect(
m_videoOutput, SIGNAL(videoWindowSizeChanged()),
this, SLOT(videoWindowSizeChanged())