[vlmc-devel] SequenceWorkflow: Use unique_ptr for m_multitrack

Yikai Lu git at videolan.org
Mon Aug 7 19:18:31 CEST 2017


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Tue Aug  8 01:18:54 2017 +0900| [9022c329314c9173e45c901ec581acb3a96e74d9] | committer: Yikai Lu

SequenceWorkflow: Use unique_ptr for m_multitrack

> https://code.videolan.org/videolan/vlmc/commit/9022c329314c9173e45c901ec581acb3a96e74d9
---

 src/Workflow/SequenceWorkflow.cpp | 5 ++---
 src/Workflow/SequenceWorkflow.h   | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/Workflow/SequenceWorkflow.cpp b/src/Workflow/SequenceWorkflow.cpp
index 3e2eb7ef..09fb60ee 100644
--- a/src/Workflow/SequenceWorkflow.cpp
+++ b/src/Workflow/SequenceWorkflow.cpp
@@ -60,7 +60,6 @@ SequenceWorkflow::SequenceWorkflow( size_t trackCount )
 
 SequenceWorkflow::~SequenceWorkflow()
 {
-    delete m_multitrack;
     clear();
 }
 
@@ -277,7 +276,7 @@ SequenceWorkflow::loadFromVariant( const QVariant& variant )
 
         EffectHelper::loadFromVariant( m["filters"], clip->input() );
     }
-    EffectHelper::loadFromVariant( variant.toMap()["filters"], m_multitrack );
+    EffectHelper::loadFromVariant( variant.toMap()["filters"], m_multitrack.get() );
 }
 
 void
@@ -317,7 +316,7 @@ SequenceWorkflow::position( const QUuid& uuid )
 Backend::IInput*
 SequenceWorkflow::input()
 {
-    return m_multitrack;
+    return m_multitrack.get();
 }
 
 Backend::IInput*
diff --git a/src/Workflow/SequenceWorkflow.h b/src/Workflow/SequenceWorkflow.h
index f4b93154..9cacb59b 100644
--- a/src/Workflow/SequenceWorkflow.h
+++ b/src/Workflow/SequenceWorkflow.h
@@ -119,9 +119,9 @@ class SequenceWorkflow : public QObject
 
         QMap<QUuid, QSharedPointer<ClipInstance>>       m_clips;
 
-        Backend::IMultiTrack*           m_multitrack;
         QList<QSharedPointer<Track>>    m_tracks[Workflow::NbTrackType];
         QList<std::shared_ptr<Backend::IMultiTrack>>    m_multiTracks;
+        std::unique_ptr<Backend::IMultiTrack>           m_multitrack;
         const size_t                    m_trackCount;
 
     signals:



More information about the Vlmc-devel mailing list