Commit 906b7d59 authored by Tobias Koenig's avatar Tobias Koenig
Browse files

Fix behaviour of VideoWidget and SnapshotTaker

Stop video player when leaving a page and before deleting the
video widget. Do not leak the video player inside the SnapshotTaker.
parent ea08b463
...@@ -27,6 +27,12 @@ SnapshotTaker::SnapshotTaker( const QString &url, QObject *parent ) ...@@ -27,6 +27,12 @@ SnapshotTaker::SnapshotTaker( const QString &url, QObject *parent )
m_player->play(); m_player->play();
} }
SnapshotTaker::~SnapshotTaker()
{
m_player->stop();
delete m_player;
}
void SnapshotTaker::stateChanged(Phonon::State newState, Phonon::State) void SnapshotTaker::stateChanged(Phonon::State newState, Phonon::State)
{ {
if (newState == Phonon::PlayingState) { if (newState == Phonon::PlayingState) {
......
...@@ -22,6 +22,7 @@ class SnapshotTaker : public QObject ...@@ -22,6 +22,7 @@ class SnapshotTaker : public QObject
public: public:
SnapshotTaker( const QString &url, QObject *parent = 0 ); SnapshotTaker( const QString &url, QObject *parent = 0 );
~SnapshotTaker();
Q_SIGNALS: Q_SIGNALS:
void finished( const QImage &image ); void finished( const QImage &image );
......
...@@ -59,10 +59,16 @@ class VideoWidget::Private ...@@ -59,10 +59,16 @@ class VideoWidget::Private
{ {
public: public:
Private( Okular::MovieAnnotation *ma, Okular::Document *doc, VideoWidget *qq ) Private( Okular::MovieAnnotation *ma, Okular::Document *doc, VideoWidget *qq )
: q( qq ), anno( ma ), document( doc ), loaded( false ) : q( qq ), anno( ma ), document( doc ), player( 0 ), loaded( false )
{ {
} }
~Private()
{
if ( player )
player->stop();
}
enum PlayPauseMode { PlayMode, PauseMode }; enum PlayPauseMode { PlayMode, PauseMode };
void load(); void load();
...@@ -344,6 +350,7 @@ void VideoWidget::pageEntered() ...@@ -344,6 +350,7 @@ void VideoWidget::pageEntered()
void VideoWidget::pageLeft() void VideoWidget::pageLeft()
{ {
d->player->stop();
d->videoStopped(); d->videoStopped();
hide(); hide();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment