[vlmc-devel] [PATCH] ClipRenderer: Fix memory leak

Yikai Lu luyikei.qmltu at gmail.com
Tue Mar 29 09:25:06 CEST 2016


---
 src/Gui/MainWindow.cpp | 7 ++++---
 src/Gui/MainWindow.h   | 2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 786effd..688fb69 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -141,6 +141,7 @@ MainWindow::~MainWindow()
 {
     if ( m_fileRenderer )
         delete m_fileRenderer;
+    delete m_clipRenderer;
     delete m_importController;
 }
 
@@ -472,10 +473,10 @@ void
 MainWindow::setupClipPreview()
 {
     m_clipPreview = new PreviewWidget;
-    auto renderer = new ClipRenderer;
-    m_clipPreview->setRenderer( renderer );
+    m_clipRenderer = new ClipRenderer;
+    m_clipPreview->setRenderer( m_clipRenderer );
     connect( Core::getInstance()->library(), SIGNAL( clipRemoved( const QUuid& ) ),
-             renderer, SLOT( clipUnloaded( const QUuid& ) ) );
+             m_clipRenderer, SLOT( clipUnloaded( const QUuid& ) ) );
 
     KeyboardShortcutHelper* clipShortcut = new KeyboardShortcutHelper( "keyboard/mediapreview", this );
     connect( clipShortcut, SIGNAL( activated() ), m_clipPreview, SLOT( on_pushButtonPlay_clicked() ) );
diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h
index 19327f5..eaa16d9 100644
--- a/src/Gui/MainWindow.h
+++ b/src/Gui/MainWindow.h
@@ -36,6 +36,7 @@ class QUndoView;
 
 class   EffectsListView;
 class   ImportController;
+class   ClipRenderer;
 class   MediaLibrary;
 class   PreviewWidget;
 class   Project;
@@ -132,6 +133,7 @@ private:
     Timeline*               m_timeline;
     Backend::IBackend*      m_backend;
     PreviewWidget*          m_clipPreview;
+    ClipRenderer*           m_clipRenderer;
     PreviewWidget*          m_projectPreview;
     WorkflowFileRenderer*   m_fileRenderer;
     SettingsDialog*         m_globalPreferences;
-- 
1.9.1



More information about the Vlmc-devel mailing list