[vlmc-devel] [PATCH 3/5] VLCSource, VmemRenderer: Delete snapshot in VLCSource

Yikai Lu luyikei.qmltu at gmail.com
Tue Apr 12 15:09:32 CEST 2016


It is used in VLCSource, which will be deleted after VmemRenderer
---
 src/Backend/VLC/VLCSource.cpp       | 6 ++++++
 src/Backend/VLC/VLCSource.h         | 1 +
 src/Backend/VLC/VLCVmemRenderer.cpp | 1 -
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/Backend/VLC/VLCSource.cpp b/src/Backend/VLC/VLCSource.cpp
index d38d12f..eee870a 100644
--- a/src/Backend/VLC/VLCSource.cpp
+++ b/src/Backend/VLC/VLCSource.cpp
@@ -43,6 +43,12 @@ VLCSource::VLCSource( VLCBackend* backend, const QString& path )
     m_media = ::VLC::Media( backend->vlcInstance(), path.toStdString(), ::VLC::Media::FromPath );
 }
 
+VLCSource::~VLCSource()
+{
+    if ( m_snapshot )
+        delete[] m_snapshot;
+}
+
 ::VLC::Media&
 VLCSource::media()
 {
diff --git a/src/Backend/VLC/VLCSource.h b/src/Backend/VLC/VLCSource.h
index b2262df..4fee4dc 100644
--- a/src/Backend/VLC/VLCSource.h
+++ b/src/Backend/VLC/VLCSource.h
@@ -40,6 +40,7 @@ class VLCSource : public ISource
 {
 public:
     VLCSource( VLCBackend* backend, const QString& path );
+    virtual ~VLCSource();
     virtual ISourceRenderer*    createRenderer( ISourceRendererEventCb* callback );
     virtual bool                preparse();
     virtual bool                isParsed() const;
diff --git a/src/Backend/VLC/VLCVmemRenderer.cpp b/src/Backend/VLC/VLCVmemRenderer.cpp
index 8312ecd..3bbf3f2 100644
--- a/src/Backend/VLC/VLCVmemRenderer.cpp
+++ b/src/Backend/VLC/VLCVmemRenderer.cpp
@@ -59,7 +59,6 @@ VmemRenderer::~VmemRenderer()
      * destroyed in a potentially locked state, while the vmem tries to lock/unlock.
      */
     stop();
-    delete[] m_snapshot;
 }
 
 ::VLC::MediaPlayer&
-- 
1.9.1



More information about the Vlmc-devel mailing list