[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [okular] ui: Fix behaviour of VideoWidget and SnapshotTaker
From: Tobias Koenig <tokoe () kde ! org>
Date: 2012-09-28 8:13:26
Message-ID: 20120928081326.33C59A6042 () git ! kde ! org
[Download RAW message or body]
Git commit 906b7d59312f203e6474a6eb23034a82bf673e73 by Tobias Koenig.
Committed on 28/09/2012 at 10:11.
Pushed by tokoe into branch 'master'.
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.
M +6 -0 ui/snapshottaker.cpp
M +1 -0 ui/snapshottaker.h
M +8 -1 ui/videowidget.cpp
http://commits.kde.org/okular/906b7d59312f203e6474a6eb23034a82bf673e73
diff --git a/ui/snapshottaker.cpp b/ui/snapshottaker.cpp
index 5e4058d..362d249 100644
--- a/ui/snapshottaker.cpp
+++ b/ui/snapshottaker.cpp
@@ -27,6 +27,12 @@ SnapshotTaker::SnapshotTaker( const QString &url, QObject *parent )
m_player->play();
}
+SnapshotTaker::~SnapshotTaker()
+{
+ m_player->stop();
+ delete m_player;
+}
+
void SnapshotTaker::stateChanged(Phonon::State newState, Phonon::State)
{
if (newState == Phonon::PlayingState) {
diff --git a/ui/snapshottaker.h b/ui/snapshottaker.h
index f9b09c0..e34c3e0 100644
--- a/ui/snapshottaker.h
+++ b/ui/snapshottaker.h
@@ -22,6 +22,7 @@ class SnapshotTaker : public QObject
public:
SnapshotTaker( const QString &url, QObject *parent = 0 );
+ ~SnapshotTaker();
Q_SIGNALS:
void finished( const QImage &image );
diff --git a/ui/videowidget.cpp b/ui/videowidget.cpp
index 3d7ebab..592ec79 100644
--- a/ui/videowidget.cpp
+++ b/ui/videowidget.cpp
@@ -59,10 +59,16 @@ class VideoWidget::Private
{
public:
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 };
void load();
@@ -344,6 +350,7 @@ void VideoWidget::pageEntered()
void VideoWidget::pageLeft()
{
+ d->player->stop();
d->videoStopped();
hide();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic