[vlmc-devel] Media: Store baseClip as QSharedPointer

Yikai Lu git at videolan.org
Mon Aug 22 22:00:59 CEST 2016


vlmc | branch: medialibrary | Yikai Lu <luyikei.qmltu at gmail.com> | Sun Aug 21 18:07:31 2016 -0500| [91ffebf9c24a4f49873b60a32ee1a30e38aac62a] | committer: Hugo Beauzée-Luyssen

Media: Store baseClip as QSharedPointer

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> https://code.videolan.org/videolan/vlmc/commit/91ffebf9c24a4f49873b60a32ee1a30e38aac62a
---

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

diff --git a/src/Media/Media.cpp b/src/Media/Media.cpp
index 00a9d0e..864a540 100644
--- a/src/Media/Media.cpp
+++ b/src/Media/Media.cpp
@@ -114,11 +114,11 @@ Media::id() const
     return m_mlMedia->id();
 }
 
-Clip*
+QSharedPointer<Clip>
 Media::baseClip()
 {
     if ( m_baseClip == nullptr )
-        m_baseClip = new Clip( sharedFromThis(), 0, Backend::IInput::EndOfMedia, m_baseClipUuid );
+        m_baseClip.reset( new Clip( sharedFromThis(), 0, Backend::IInput::EndOfMedia, m_baseClipUuid ) );
     return m_baseClip;
 }
 
diff --git a/src/Media/Media.h b/src/Media/Media.h
index 9172917..9f9193a 100644
--- a/src/Media/Media.h
+++ b/src/Media/Media.h
@@ -86,7 +86,7 @@ public:
     QString                     title() const;
     qint64                      id() const;
 
-    Clip*                       baseClip();
+    QSharedPointer<Clip>        baseClip();
 
     /**
      * @brief cut   Creates a clip to represent a cut of a media
@@ -114,7 +114,7 @@ protected:
     medialibrary::MediaPtr      m_mlMedia;
     medialibrary::FilePtr       m_mlFile;
     QUuid                       m_baseClipUuid;
-    mutable Clip*               m_baseClip;
+    QSharedPointer<Clip>        m_baseClip;
     QHash<QUuid, QSharedPointer<Clip>>      m_clips;
 
 signals:



More information about the Vlmc-devel mailing list