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 15:58:12 (GMT) |
commit | 584309d3d42f3118efade8f499a3f223665f3d86 (patch) | |
tree | d75b7286bd773f3e07e5d9b11aa65da7d1574dc5 /src/3rdparty/phonon/mmf | |
parent | 1b598281b5071dff6b1c1510fcb4d41a300c47a4 (diff) | |
download | Qt-584309d3d42f3118efade8f499a3f223665f3d86.zip Qt-584309d3d42f3118efade8f499a3f223665f3d86.tar.gz Qt-584309d3d42f3118efade8f499a3f223665f3d86.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')
-rw-r--r-- | src/3rdparty/phonon/mmf/abstractvideoplayer.cpp | 10 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/videoplayer_dsa.cpp | 7 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/videoplayer_surface.cpp | 5 |
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()) |