[vlmc-devel] Core: Remove side effects from the destructor.
Hugo Beauzée-Luyssen
git at videolan.org
Mon Jul 4 15:34:47 CEST 2016
vlmc | branch: medialibrary | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Jun 27 20:45:23 2016 +0200| [7b8bef64072d88416182a7261018d5ed3ec179b0] | committer: Hugo Beauzée-Luyssen
Core: Remove side effects from the destructor.
Invoking Settings::save() might cause logging, which requires a valid
Core instance. Doing so from the constructor isn't a good idea
> https://code.videolan.org/videolan/vlmc/commit/7b8bef64072d88416182a7261018d5ed3ec179b0
---
src/Main/Core.cpp | 1 -
src/Main/main.cpp | 9 +++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/Main/Core.cpp b/src/Main/Core.cpp
index d27185a..3025785 100644
--- a/src/Main/Core.cpp
+++ b/src/Main/Core.cpp
@@ -66,7 +66,6 @@ Core::Core()
Core::~Core()
{
- m_settings->save();
delete m_library;
delete m_undoStack;
delete m_workflow;
diff --git a/src/Main/main.cpp b/src/Main/main.cpp
index dc03f9e..4890633 100644
--- a/src/Main/main.cpp
+++ b/src/Main/main.cpp
@@ -34,6 +34,7 @@
#include "Project/Project.h"
#include "Backend/IBackend.h"
#include "Main/Core.h"
+#include "Settings/Settings.h"
#ifdef WITH_GUI
#include "Gui/MainWindow.h"
#include "Gui/IntroDialog.h"
@@ -170,7 +171,9 @@ VLMCGuimain( int argc, char **argv )
/* Main Window display */
w.show();
- return app.exec();
+ auto res = app.exec();
+ Core::instance()->settings()->save();
+ return res;
}
#endif
/**
@@ -204,7 +207,9 @@ VLMCCoremain( int argc, char **argv )
QCoreApplication::connect( p, &Project::projectLoaded, &renderer, &ConsoleRenderer::startRender );
p->load( app.arguments()[1] );
#endif
- return app.exec();
+ auto res = app.exec();
+ Core::instance()->settings()->save();
+ return res;
}
int
More information about the Vlmc-devel
mailing list