From c01bc165db295d7a055b7388dbbaf80d24fc85e5 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 22 Sep 2015 16:30:06 +0300 Subject: [PATCH] Fix memory leaks. --HG-- branch : develop --- src/app/valentina/core/vcmdexport.cpp | 7 +++++++ src/app/valentina/core/vcmdexport.h | 7 +++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/valentina/core/vcmdexport.cpp b/src/app/valentina/core/vcmdexport.cpp index 82de220ef..0edcae108 100644 --- a/src/app/valentina/core/vcmdexport.cpp +++ b/src/app/valentina/core/vcmdexport.cpp @@ -294,6 +294,13 @@ VCommandLinePtr VCommandLine::Get(const QCoreApplication& app) return instance; } +//--------------------------------------------------------------------------------------------------------------------- +VCommandLine::~VCommandLine() +{ + qDeleteAll(optionsUsed.begin(), optionsUsed.end()); + optionsUsed.clear(); +} + //------------------------------------------------------------------------------------------------------ Q_NORETURN void VCommandLine::Error(const QString &text) const { diff --git a/src/app/valentina/core/vcmdexport.h b/src/app/valentina/core/vcmdexport.h index b69e0e9a5..11709316c 100644 --- a/src/app/valentina/core/vcmdexport.h +++ b/src/app/valentina/core/vcmdexport.h @@ -49,7 +49,7 @@ class VCommandLine private: static VCommandLinePtr instance; QCommandLineParser parser; - const QMap optionsUsed; + QMap optionsUsed; bool isGuiEnabled; friend class VApplication; @@ -77,9 +77,8 @@ protected: static VCommandLinePtr Get(const QCoreApplication& app); public: - VCommandLine(const VCommandLine&) = delete; - VCommandLine& operator =(const VCommandLine&) = delete; - virtual ~VCommandLine(){} + Q_DISABLE_COPY(VCommandLine) + virtual ~VCommandLine(); //@brief creates object and applies export related options to parser