diff --git a/src/engine/gstenginepipeline.cpp b/src/engine/gstenginepipeline.cpp index 31a26ed61..fa8dfe3d0 100644 --- a/src/engine/gstenginepipeline.cpp +++ b/src/engine/gstenginepipeline.cpp @@ -122,6 +122,13 @@ GstEnginePipeline::~GstEnginePipeline() { if (pipeline_) { + if (fader_) { + if (fader_->state() != QTimeLine::NotRunning) { + fader_->stop(); + } + fader_.reset(); + } + if (pad_added_cb_id_ != -1) { g_signal_handler_disconnect(G_OBJECT(pipeline_), pad_added_cb_id_); } @@ -1414,7 +1421,12 @@ void GstEnginePipeline::StartFader(const qint64 duration_nanosec, const QTimeLin } } - fader_ = std::make_unique(duration_msec, this); + fader_.reset(new QTimeLine(duration_msec), [](QTimeLine *timeline) { + if (timeline->state() != QTimeLine::NotRunning) { + timeline->stop(); + } + timeline->deleteLater(); + }); QObject::connect(fader_.get(), &QTimeLine::valueChanged, this, &GstEnginePipeline::SetVolumeModifier); QObject::connect(fader_.get(), &QTimeLine::finished, this, &GstEnginePipeline::FaderTimelineFinished); fader_->setDirection(direction); diff --git a/src/engine/gstenginepipeline.h b/src/engine/gstenginepipeline.h index 6b4dff7a9..1c789dc37 100644 --- a/src/engine/gstenginepipeline.h +++ b/src/engine/gstenginepipeline.h @@ -269,7 +269,7 @@ class GstEnginePipeline : public QObject { uint volume_percent_; qreal volume_modifier_; - std::unique_ptr fader_; + std::shared_ptr fader_; QBasicTimer fader_fudge_timer_; bool use_fudge_timer_;