diff options
5 files changed, 10 insertions, 14 deletions
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/KDUpdater/environment.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/KDUpdater/environment.cpp index c1ddc11f1..f269bba72 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/KDUpdater/environment.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/KDUpdater/environment.cpp @@ -8,11 +8,11 @@ using namespace KDUpdater; class Environment::Private { public: - static Environment* s_instance; + static Environment s_instance; QHash<QString, QString> tempValues; }; -Environment* Environment::Private::s_instance = 0; +Environment Environment::Private::s_instance; Environment::Environment() : d( new Private ) @@ -23,9 +23,7 @@ Environment::~Environment() { delete d; } -Environment* Environment::instance() { - if ( !Private::s_instance ) - Private::s_instance = new Environment; +Environment& Environment::instance() { return Private::s_instance; } diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/KDUpdater/environment.h b/installerbuilder/libinstaller/3rdparty/kdtools/KDUpdater/environment.h index 7d6169314..2c0d272d1 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/KDUpdater/environment.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/KDUpdater/environment.h @@ -14,7 +14,7 @@ namespace KDUpdater { class KDTOOLS_UPDATER_EXPORT Environment { public: - static Environment* instance(); + static Environment& instance(); ~Environment(); diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/KDUpdater/kdupdaterupdateoperations.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/KDUpdater/kdupdaterupdateoperations.cpp index a1486d34d..769f9a36d 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/KDUpdater/kdupdaterupdateoperations.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/KDUpdater/kdupdaterupdateoperations.cpp @@ -935,7 +935,7 @@ bool ExecuteOperation::performOperation() else #endif { - Environment::instance()->applyTo( &process ); //apply non-persistent variables + Environment::instance().applyTo( &process ); //apply non-persistent variables process.start( args.front(), args.mid( 1 ) ); QEventLoop loop; diff --git a/installerbuilder/libinstaller/elevatedexecuteoperation.cpp b/installerbuilder/libinstaller/elevatedexecuteoperation.cpp index c2029b8c8..7389e6621 100644 --- a/installerbuilder/libinstaller/elevatedexecuteoperation.cpp +++ b/installerbuilder/libinstaller/elevatedexecuteoperation.cpp @@ -150,11 +150,9 @@ bool ElevatedExecuteOperation::Private::run(const QStringList& arguments) } QProcessEnvironment penv; - KDUpdater::Environment *kdEnv = KDUpdater::Environment::instance(); // there is no way to serialize a QProcessEnvironment properly other than per mangled QStringList: // (i.e. no other way to list all keys) - process->setEnvironment(kdEnv->applyTo(penv).toStringList()); - delete kdEnv; + process->setEnvironment(KDUpdater::Environment::instance().applyTo(penv).toStringList()); if (showStandardError) process->setProcessChannelMode(QProcessWrapper::MergedChannels); diff --git a/installerbuilder/libinstaller/environmentvariablesoperation.cpp b/installerbuilder/libinstaller/environmentvariablesoperation.cpp index 1b4ca2c86..4381cd387 100644 --- a/installerbuilder/libinstaller/environmentvariablesoperation.cpp +++ b/installerbuilder/libinstaller/environmentvariablesoperation.cpp @@ -172,8 +172,8 @@ bool EnvironmentVariableOperation::performOperation() #endif Q_ASSERT( !isPersistent ); - setValue( QLatin1String( "oldvalue" ), Environment::instance()->value( name ) ); - Environment::instance()->setTemporaryValue( name, value ); + setValue( QLatin1String( "oldvalue" ), Environment::instance().value( name ) ); + Environment::instance().setTemporaryValue( name, value ); return true; } @@ -194,10 +194,10 @@ bool EnvironmentVariableOperation::undoOperation() #endif if ( !isPersistent ) { - const QString actual = Environment::instance()->value( name ); + const QString actual = Environment::instance().value( name ); const bool doUndo = actual == value; if ( doUndo ) - Environment::instance()->setTemporaryValue( name, oldvalue ); + Environment::instance().setTemporaryValue( name, oldvalue ); return doUndo; } |