aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/PackProfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/minecraft/PackProfile.cpp')
-rw-r--r--launcher/minecraft/PackProfile.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/launcher/minecraft/PackProfile.cpp b/launcher/minecraft/PackProfile.cpp
index 42021b3c..da7c1d84 100644
--- a/launcher/minecraft/PackProfile.cpp
+++ b/launcher/minecraft/PackProfile.cpp
@@ -130,7 +130,7 @@ static ComponentPtr componentFromJsonV1(PackProfile * parent, const QString & co
// critical
auto uid = Json::requireString(obj.value("uid"));
auto filePath = componentJsonPattern.arg(uid);
- auto component = new Component(parent, uid);
+ auto component = makeShared<Component>(parent, uid);
component->m_version = Json::ensureString(obj.value("version"));
component->m_dependencyOnly = Json::ensureBoolean(obj.value("dependencyOnly"), false);
component->m_important = Json::ensureBoolean(obj.value("important"), false);
@@ -518,23 +518,23 @@ bool PackProfile::revertToBase(int index)
return true;
}
-Component * PackProfile::getComponent(const QString &id)
+ComponentPtr PackProfile::getComponent(const QString &id)
{
auto iter = d->componentIndex.find(id);
if (iter == d->componentIndex.end())
{
return nullptr;
}
- return (*iter).get();
+ return (*iter);
}
-Component * PackProfile::getComponent(int index)
+ComponentPtr PackProfile::getComponent(int index)
{
if(index < 0 || index >= d->components.size())
{
return nullptr;
}
- return d->components[index].get();
+ return d->components[index];
}
QVariant PackProfile::data(const QModelIndex &index, int role) const
@@ -765,7 +765,7 @@ bool PackProfile::installEmpty(const QString& uid, const QString& name)
file.write(OneSixVersionFormat::versionFileToJson(f).toJson());
file.close();
- appendComponent(new Component(this, f->uid, f));
+ appendComponent(makeShared<Component>(this, f->uid, f));
scheduleSave();
invalidateLaunchProfile();
return true;
@@ -872,7 +872,7 @@ bool PackProfile::installJarMods_internal(QStringList filepaths)
file.write(OneSixVersionFormat::versionFileToJson(f).toJson());
file.close();
- appendComponent(new Component(this, f->uid, f));
+ appendComponent(makeShared<Component>(this, f->uid, f));
}
scheduleSave();
invalidateLaunchProfile();
@@ -933,7 +933,7 @@ bool PackProfile::installCustomJar_internal(QString filepath)
file.write(OneSixVersionFormat::versionFileToJson(f).toJson());
file.close();
- appendComponent(new Component(this, f->uid, f));
+ appendComponent(makeShared<Component>(this, f->uid, f));
scheduleSave();
invalidateLaunchProfile();
@@ -989,7 +989,7 @@ bool PackProfile::installAgents_internal(QStringList filepaths)
patchFile.write(OneSixVersionFormat::versionFileToJson(versionFile).toJson());
patchFile.close();
- appendComponent(new Component(this, versionFile->uid, versionFile));
+ appendComponent(makeShared<Component>(this, versionFile->uid, versionFile));
}
scheduleSave();
@@ -1038,7 +1038,7 @@ bool PackProfile::setComponentVersion(const QString& uid, const QString& version
else
{
// add new
- auto component = new Component(this, uid);
+ auto component = makeShared<Component>(this, uid);
component->m_version = version;
component->m_important = important;
appendComponent(component);