[vlmc-devel] Clip: Store Media as QWeakPointer

Hugo Beauzée-Luyssen git at videolan.org
Fri Aug 19 02:41:52 CEST 2016


vlmc | branch: medialibrary | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Aug 19 02:40:51 2016 +0200| [ad0910508fef273956129dd069ddd53888aee8ee] | committer: Hugo Beauzée-Luyssen

Clip: Store Media as QWeakPointer

Having the Media holding a shared pointer to the clips and vice versa
has circular dependency written all over it.

> https://code.videolan.org/videolan/vlmc/commit/ad0910508fef273956129dd069ddd53888aee8ee
---

 src/Media/Clip.cpp | 2 +-
 src/Media/Clip.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Media/Clip.cpp b/src/Media/Clip.cpp
index 1f81ca6..47faeeb 100644
--- a/src/Media/Clip.cpp
+++ b/src/Media/Clip.cpp
@@ -43,7 +43,7 @@ Clip::Clip( QSharedPointer<Media> media, qint64 begin /*= 0*/, qint64 end /*= Ba
         //FIXME: uuid -> QString conversion should be removed, since the helper stores the UUID as a QUuid
         Workflow::Helper( uuid.toString() ),
         m_media( media ),
-        m_input( std::move( m_media->input()->cut( begin, end ) ) ),
+        m_input( std::move( media->input()->cut( begin, end ) ) ),
         m_isLinked( false )
 {
     Formats f;
diff --git a/src/Media/Clip.h b/src/Media/Clip.h
index 12b96a3..8690f2a 100644
--- a/src/Media/Clip.h
+++ b/src/Media/Clip.h
@@ -119,7 +119,7 @@ class   Clip : public Workflow::Helper
         void                loadFilters(const QVariantMap& v );
 
     private:
-        QSharedPointer<Media>               m_media;
+        QWeakPointer<Media>                 m_media;
         std::unique_ptr<Backend::IInput>    m_input;
 
         QStringList         m_metaTags;



More information about the Vlmc-devel mailing list