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;
|
||||
kept.intersect(newSet);
|
||||
for(auto& keptMod : kept) {
|
||||
auto* newMod = newMods[keptMod];
|
||||
auto newMod = newMods[keptMod];
|
||||
auto row = modsIndex[keptMod];
|
||||
auto currentMod = mods[row];
|
||||
if(newMod->dateTimeChanged() == currentMod->dateTimeChanged()) {
|
||||
|
@ -36,7 +36,6 @@
|
||||
|
||||
#include "ModFolderLoadTask.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "minecraft/mod/MetadataHandler.h"
|
||||
|
||||
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
|
||||
m_mods_dir.refresh();
|
||||
for (auto entry : m_mods_dir.entryInfoList()) {
|
||||
auto* mod = new Mod(entry);
|
||||
Mod::Ptr mod(new Mod(entry));
|
||||
|
||||
if (mod->enabled()) {
|
||||
if (m_result->mods.contains(mod->internal_id())) {
|
||||
|
@ -48,7 +48,7 @@ class ModFolderLoadTask : public QObject, public QRunnable
|
||||
Q_OBJECT
|
||||
public:
|
||||
struct Result {
|
||||
QMap<QString, Mod*> mods;
|
||||
QMap<QString, Mod::Ptr> mods;
|
||||
};
|
||||
using ResultPtr = std::shared_ptr<Result>;
|
||||
ResultPtr result() const {
|
||||
|
Loading…
Reference in New Issue
Block a user