diff options
author | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-06-08 10:30:05 (GMT) |
---|---|---|
committer | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-07-07 12:19:31 (GMT) |
commit | 0c71b098965ce4779a7da785249497c15b9d1d14 (patch) | |
tree | de2dd5a90b6282400938c3135f1e6d65e8e2bdbe /src/3rdparty/phonon/mmf/abstractvideoplayer.cpp | |
parent | e7f6c2d9625bda1d063b9ec3acd7eb5f79f30ba7 (diff) | |
download | Qt-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/phonon/mmf/abstractvideoplayer.cpp')
-rw-r--r-- | src/3rdparty/phonon/mmf/abstractvideoplayer.cpp | 10 |
1 files changed, 8 insertions, 2 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; |