fix: raw-pointers and leaks in ModFolderLoadTask
Co-authored-by: timoreo <contact@timoreo.fr> Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
6bb8332b4b
commit
54b335711a
@ -143,7 +143,7 @@ void ModFolderModel::finishUpdate()
|
|||||||
QSet<QString> kept = currentSet;
|
QSet<QString> kept = currentSet;
|
||||||
kept.intersect(newSet);
|
kept.intersect(newSet);
|
||||||
for(auto& keptMod : kept) {
|
for(auto& keptMod : kept) {
|
||||||
auto* newMod = newMods[keptMod];
|
auto newMod = newMods[keptMod];
|
||||||
auto row = modsIndex[keptMod];
|
auto row = modsIndex[keptMod];
|
||||||
auto currentMod = mods[row];
|
auto currentMod = mods[row];
|
||||||
if(newMod->dateTimeChanged() == currentMod->dateTimeChanged()) {
|
if(newMod->dateTimeChanged() == currentMod->dateTimeChanged()) {
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
|
|
||||||
#include "ModFolderLoadTask.h"
|
#include "ModFolderLoadTask.h"
|
||||||
|
|
||||||
#include "Application.h"
|
|
||||||
#include "minecraft/mod/MetadataHandler.h"
|
#include "minecraft/mod/MetadataHandler.h"
|
||||||
|
|
||||||
ModFolderLoadTask::ModFolderLoadTask(QDir& mods_dir, QDir& index_dir, bool is_indexed)
|
ModFolderLoadTask::ModFolderLoadTask(QDir& mods_dir, QDir& index_dir, bool is_indexed)
|
||||||
@ -53,7 +52,7 @@ void ModFolderLoadTask::run()
|
|||||||
// Read JAR files that don't have metadata
|
// Read JAR files that don't have metadata
|
||||||
m_mods_dir.refresh();
|
m_mods_dir.refresh();
|
||||||
for (auto entry : m_mods_dir.entryInfoList()) {
|
for (auto entry : m_mods_dir.entryInfoList()) {
|
||||||
auto* mod = new Mod(entry);
|
Mod::Ptr mod(new Mod(entry));
|
||||||
|
|
||||||
if (mod->enabled()) {
|
if (mod->enabled()) {
|
||||||
if (m_result->mods.contains(mod->internal_id())) {
|
if (m_result->mods.contains(mod->internal_id())) {
|
||||||
|
@ -48,7 +48,7 @@ class ModFolderLoadTask : public QObject, public QRunnable
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
struct Result {
|
struct Result {
|
||||||
QMap<QString, Mod*> mods;
|
QMap<QString, Mod::Ptr> mods;
|
||||||
};
|
};
|
||||||
using ResultPtr = std::shared_ptr<Result>;
|
using ResultPtr = std::shared_ptr<Result>;
|
||||||
ResultPtr result() const {
|
ResultPtr result() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user