[vlmc-devel] Library: Use unique_ptr for m_settings

Yikai Lu git at videolan.org
Sat Jul 8 17:16:10 CEST 2017


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Fri Jul  7 19:02:55 2017 +0900| [16cc4991d3f755c947a577d0357b3fa0193a15ea] | committer: Yikai Lu

Library: Use unique_ptr for m_settings

> https://code.videolan.org/videolan/vlmc/commit/16cc4991d3f755c947a577d0357b3fa0193a15ea
---

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

diff --git a/src/Library/Library.cpp b/src/Library/Library.cpp
index a978e365..7a891cc0 100644
--- a/src/Library/Library.cpp
+++ b/src/Library/Library.cpp
@@ -62,8 +62,8 @@ Library::Library( Settings* vlmcSettings, Settings *projectSettings )
 
     // Setting up the project section of the Library
     m_settings->createVar( SettingValue::List, QString( "medias" ), QVariantList(), "", "", SettingValue::Nothing );
-    connect( m_settings, &Settings::postLoad, this, &Library::postLoad, Qt::DirectConnection );
-    connect( m_settings, &Settings::preSave, this, &Library::preSave, Qt::DirectConnection );
+    connect( m_settings.get(), &Settings::postLoad, this, &Library::postLoad, Qt::DirectConnection );
+    connect( m_settings.get(), &Settings::preSave, this, &Library::preSave, Qt::DirectConnection );
     projectSettings->addSettings( "Library", *m_settings );
 }
 
@@ -96,7 +96,6 @@ Library::postLoad()
 
 Library::~Library()
 {
-    delete m_settings;
 }
 
 void
diff --git a/src/Library/Library.h b/src/Library/Library.h
index a1e27850..b38f276a 100644
--- a/src/Library/Library.h
+++ b/src/Library/Library.h
@@ -111,7 +111,7 @@ private:
 private:
     std::unique_ptr<medialibrary::IMediaLibrary>    m_ml;
     MediaLibraryModel*                              m_model;
-    Settings*                                       m_settings;
+    std::unique_ptr<Settings>                       m_settings;
     bool                                            m_initialized;
     bool                                            m_cleanState;
 



More information about the Vlmc-devel mailing list