diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-03-30 20:11:05 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-03-30 20:11:41 +0200 |
commit | fbc29b6a0626f2ce8521dc74e3171b634d68e9e5 (patch) | |
tree | d2d79201be585131be2ab0cd7d337237887af5a0 /logic/tools | |
parent | e1e1d99102936b419aac52974f1fdb8be835b0d4 (diff) | |
download | MultiMC-fbc29b6a0626f2ce8521dc74e3171b634d68e9e5.tar MultiMC-fbc29b6a0626f2ce8521dc74e3171b634d68e9e5.tar.gz MultiMC-fbc29b6a0626f2ce8521dc74e3171b634d68e9e5.tar.lz MultiMC-fbc29b6a0626f2ce8521dc74e3171b634d68e9e5.tar.xz MultiMC-fbc29b6a0626f2ce8521dc74e3171b634d68e9e5.zip |
Fix many memory leaks.
Diffstat (limited to 'logic/tools')
-rw-r--r-- | logic/tools/BaseExternalTool.cpp | 7 | ||||
-rw-r--r-- | logic/tools/BaseExternalTool.h | 11 | ||||
-rw-r--r-- | logic/tools/BaseProfiler.cpp | 4 | ||||
-rw-r--r-- | logic/tools/BaseProfiler.h | 4 | ||||
-rw-r--r-- | logic/tools/JProfiler.cpp | 4 | ||||
-rw-r--r-- | logic/tools/JProfiler.h | 4 | ||||
-rw-r--r-- | logic/tools/JVisualVM.cpp | 4 | ||||
-rw-r--r-- | logic/tools/JVisualVM.h | 4 | ||||
-rw-r--r-- | logic/tools/MCEditTool.cpp | 4 | ||||
-rw-r--r-- | logic/tools/MCEditTool.h | 4 |
10 files changed, 26 insertions, 24 deletions
diff --git a/logic/tools/BaseExternalTool.cpp b/logic/tools/BaseExternalTool.cpp index 69cddd00..23f154e2 100644 --- a/logic/tools/BaseExternalTool.cpp +++ b/logic/tools/BaseExternalTool.cpp @@ -11,7 +11,7 @@ #include "logic/BaseInstance.h" #include "MultiMC.h" -BaseExternalTool::BaseExternalTool(BaseInstance *instance, QObject *parent) +BaseExternalTool::BaseExternalTool(InstancePtr instance, QObject *parent) : QObject(parent), m_instance(instance) { } @@ -55,7 +55,7 @@ QString BaseExternalTool::getSave() const } -BaseDetachedTool::BaseDetachedTool(BaseInstance *instance, QObject *parent) +BaseDetachedTool::BaseDetachedTool(InstancePtr instance, QObject *parent) : BaseExternalTool(instance, parent) { @@ -71,7 +71,8 @@ BaseExternalToolFactory::~BaseExternalToolFactory() { } -BaseDetachedTool *BaseDetachedToolFactory::createDetachedTool(BaseInstance *instance, QObject *parent) +BaseDetachedTool *BaseDetachedToolFactory::createDetachedTool(InstancePtr instance, + QObject *parent) { return qobject_cast<BaseDetachedTool *>(createTool(instance, parent)); } diff --git a/logic/tools/BaseExternalTool.h b/logic/tools/BaseExternalTool.h index e8965bfd..7672bf10 100644 --- a/logic/tools/BaseExternalTool.h +++ b/logic/tools/BaseExternalTool.h @@ -1,6 +1,7 @@ #pragma once #include <QObject> +#include <logic/BaseInstance.h> class BaseInstance; class SettingsObject; @@ -11,11 +12,11 @@ class BaseExternalTool : public QObject { Q_OBJECT public: - explicit BaseExternalTool(BaseInstance *instance, QObject *parent = 0); + explicit BaseExternalTool(InstancePtr instance, QObject *parent = 0); virtual ~BaseExternalTool(); protected: - BaseInstance *m_instance; + InstancePtr m_instance; qint64 pid(QProcess *process); QString getSave() const; @@ -25,7 +26,7 @@ class BaseDetachedTool : public BaseExternalTool { Q_OBJECT public: - explicit BaseDetachedTool(BaseInstance *instance, QObject *parent = 0); + explicit BaseDetachedTool(InstancePtr instance, QObject *parent = 0); public slots: @@ -44,7 +45,7 @@ public: virtual void registerSettings(SettingsObject *settings) = 0; - virtual BaseExternalTool *createTool(BaseInstance *instance, QObject *parent = 0) = 0; + virtual BaseExternalTool *createTool(InstancePtr instance, QObject *parent = 0) = 0; virtual bool check(QString *error) = 0; virtual bool check(const QString &path, QString *error) = 0; @@ -53,5 +54,5 @@ public: class BaseDetachedToolFactory : public BaseExternalToolFactory { public: - virtual BaseDetachedTool *createDetachedTool(BaseInstance *instance, QObject *parent = 0); + virtual BaseDetachedTool *createDetachedTool(InstancePtr instance, QObject *parent = 0); }; diff --git a/logic/tools/BaseProfiler.cpp b/logic/tools/BaseProfiler.cpp index 9aaca793..7cd1c5c7 100644 --- a/logic/tools/BaseProfiler.cpp +++ b/logic/tools/BaseProfiler.cpp @@ -2,7 +2,7 @@ #include <QProcess> -BaseProfiler::BaseProfiler(BaseInstance *instance, QObject *parent) +BaseProfiler::BaseProfiler(InstancePtr instance, QObject *parent) : BaseExternalTool(instance, parent) { } @@ -29,7 +29,7 @@ void BaseProfiler::abortProfilingImpl() emit abortLaunch(tr("Profiler aborted")); } -BaseProfiler *BaseProfilerFactory::createProfiler(BaseInstance *instance, QObject *parent) +BaseProfiler *BaseProfilerFactory::createProfiler(InstancePtr instance, QObject *parent) { return qobject_cast<BaseProfiler *>(createTool(instance, parent)); } diff --git a/logic/tools/BaseProfiler.h b/logic/tools/BaseProfiler.h index ec57578e..dd841da4 100644 --- a/logic/tools/BaseProfiler.h +++ b/logic/tools/BaseProfiler.h @@ -11,7 +11,7 @@ class BaseProfiler : public BaseExternalTool { Q_OBJECT public: - explicit BaseProfiler(BaseInstance *instance, QObject *parent = 0); + explicit BaseProfiler(InstancePtr instance, QObject *parent = 0); public slots: @@ -32,5 +32,5 @@ signals: class BaseProfilerFactory : public BaseExternalToolFactory { public: - virtual BaseProfiler *createProfiler(BaseInstance *instance, QObject *parent = 0); + virtual BaseProfiler *createProfiler(InstancePtr instance, QObject *parent = 0); }; diff --git a/logic/tools/JProfiler.cpp b/logic/tools/JProfiler.cpp index bb851f0b..35d5d304 100644 --- a/logic/tools/JProfiler.cpp +++ b/logic/tools/JProfiler.cpp @@ -8,7 +8,7 @@ #include "logic/BaseInstance.h" #include "MultiMC.h" -JProfiler::JProfiler(BaseInstance *instance, QObject *parent) : BaseProfiler(instance, parent) +JProfiler::JProfiler(InstancePtr instance, QObject *parent) : BaseProfiler(instance, parent) { } @@ -46,7 +46,7 @@ void JProfilerFactory::registerSettings(SettingsObject *settings) settings->registerSetting("JProfilerPort", 42042); } -BaseExternalTool *JProfilerFactory::createTool(BaseInstance *instance, QObject *parent) +BaseExternalTool *JProfilerFactory::createTool(InstancePtr instance, QObject *parent) { return new JProfiler(instance, parent); } diff --git a/logic/tools/JProfiler.h b/logic/tools/JProfiler.h index 88a02462..b3fa6ec7 100644 --- a/logic/tools/JProfiler.h +++ b/logic/tools/JProfiler.h @@ -6,7 +6,7 @@ class JProfiler : public BaseProfiler { Q_OBJECT public: - JProfiler(BaseInstance *instance, QObject *parent = 0); + JProfiler(InstancePtr instance, QObject *parent = 0); protected: void beginProfilingImpl(MinecraftProcess *process); @@ -17,7 +17,7 @@ class JProfilerFactory : public BaseProfilerFactory public: QString name() const override { return "JProfiler"; } void registerSettings(SettingsObject *settings) override; - BaseExternalTool *createTool(BaseInstance *instance, QObject *parent = 0) override; + BaseExternalTool *createTool(InstancePtr instance, QObject *parent = 0) override; bool check(QString *error) override; bool check(const QString &path, QString *error) override; }; diff --git a/logic/tools/JVisualVM.cpp b/logic/tools/JVisualVM.cpp index 02938028..02e7d8b5 100644 --- a/logic/tools/JVisualVM.cpp +++ b/logic/tools/JVisualVM.cpp @@ -8,7 +8,7 @@ #include "logic/BaseInstance.h" #include "MultiMC.h" -JVisualVM::JVisualVM(BaseInstance *instance, QObject *parent) : BaseProfiler(instance, parent) +JVisualVM::JVisualVM(InstancePtr instance, QObject *parent) : BaseProfiler(instance, parent) { } @@ -47,7 +47,7 @@ void JVisualVMFactory::registerSettings(SettingsObject *settings) settings->registerSetting("JVisualVMPath", defaultValue); } -BaseExternalTool *JVisualVMFactory::createTool(BaseInstance *instance, QObject *parent) +BaseExternalTool *JVisualVMFactory::createTool(InstancePtr instance, QObject *parent) { return new JVisualVM(instance, parent); } diff --git a/logic/tools/JVisualVM.h b/logic/tools/JVisualVM.h index af94fe55..dffdde36 100644 --- a/logic/tools/JVisualVM.h +++ b/logic/tools/JVisualVM.h @@ -6,7 +6,7 @@ class JVisualVM : public BaseProfiler { Q_OBJECT public: - JVisualVM(BaseInstance *instance, QObject *parent = 0); + JVisualVM(InstancePtr instance, QObject *parent = 0); protected: void beginProfilingImpl(MinecraftProcess *process); @@ -17,7 +17,7 @@ class JVisualVMFactory : public BaseProfilerFactory public: QString name() const override { return "JVisualVM"; } void registerSettings(SettingsObject *settings) override; - BaseExternalTool *createTool(BaseInstance *instance, QObject *parent = 0) override; + BaseExternalTool *createTool(InstancePtr instance, QObject *parent = 0) override; bool check(QString *error) override; bool check(const QString &path, QString *error) override; }; diff --git a/logic/tools/MCEditTool.cpp b/logic/tools/MCEditTool.cpp index e22a5d4a..36b8d5bd 100644 --- a/logic/tools/MCEditTool.cpp +++ b/logic/tools/MCEditTool.cpp @@ -9,7 +9,7 @@ #include "logic/BaseInstance.h" #include "MultiMC.h" -MCEditTool::MCEditTool(BaseInstance *instance, QObject *parent) +MCEditTool::MCEditTool(InstancePtr instance, QObject *parent) : BaseDetachedTool(instance, parent) { } @@ -47,7 +47,7 @@ void MCEditFactory::registerSettings(SettingsObject *settings) { settings->registerSetting("MCEditPath"); } -BaseExternalTool *MCEditFactory::createTool(BaseInstance *instance, QObject *parent) +BaseExternalTool *MCEditFactory::createTool(InstancePtr instance, QObject *parent) { return new MCEditTool(instance, parent); } diff --git a/logic/tools/MCEditTool.h b/logic/tools/MCEditTool.h index b0ed1ad4..9985bde1 100644 --- a/logic/tools/MCEditTool.h +++ b/logic/tools/MCEditTool.h @@ -6,7 +6,7 @@ class MCEditTool : public BaseDetachedTool { Q_OBJECT public: - explicit MCEditTool(BaseInstance *instance, QObject *parent = 0); + explicit MCEditTool(InstancePtr instance, QObject *parent = 0); protected: void runImpl() override; @@ -17,7 +17,7 @@ class MCEditFactory : public BaseDetachedToolFactory public: QString name() const override { return "MCEdit"; } void registerSettings(SettingsObject *settings) override; - BaseExternalTool *createTool(BaseInstance *instance, QObject *parent = 0) override; + BaseExternalTool *createTool(InstancePtr instance, QObject *parent = 0) override; bool check(QString *error) override; bool check(const QString &path, QString *error) override; }; |