mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Fixed some minor memory leaks related to gamelist.xml entries when the file extension was no longer configured
This commit is contained in:
parent
35e7cd0b77
commit
8cea8e3783
|
@ -65,7 +65,9 @@ namespace GamelistFileParser
|
||||||
return treeNode;
|
return treeNode;
|
||||||
|
|
||||||
if (type == FOLDER) {
|
if (type == FOLDER) {
|
||||||
LOG(LogWarning) << "A folder defined in the gamelist file does not exist:";
|
LOG(LogWarning) << "A folder defined in gamelist.xml does not exist or "
|
||||||
|
"contains no valid games: \""
|
||||||
|
<< path << "\"";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +85,8 @@ namespace GamelistFileParser
|
||||||
#endif
|
#endif
|
||||||
<< "\" is present in gamelist.xml but the extension is not "
|
<< "\" is present in gamelist.xml but the extension is not "
|
||||||
"configured in es_systems.xml";
|
"configured in es_systems.xml";
|
||||||
// In the unlikely event that this was the only entry in the folder.
|
// In case there are no entries left in the folder.
|
||||||
if (treeNode->getChildren().empty())
|
if (treeNode != system->getRootFolder() && treeNode->getChildren().empty())
|
||||||
delete treeNode;
|
delete treeNode;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +103,9 @@ namespace GamelistFileParser
|
||||||
// Don't create folders unless they're including any games.
|
// Don't create folders unless they're including any games.
|
||||||
// If the type is FOLDER it's going to be empty, so don't bother.
|
// If the type is FOLDER it's going to be empty, so don't bother.
|
||||||
if (type == FOLDER) {
|
if (type == FOLDER) {
|
||||||
LOG(LogWarning) << "A folder defined in the gamelist file does not exist:";
|
LOG(LogWarning) << "A folder defined in gamelist.xml does not exist or "
|
||||||
|
"contains no valid games: \""
|
||||||
|
<< path << "\"";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +278,11 @@ namespace GamelistFileParser
|
||||||
<< (type == GAME ? "file" : "folder") << " entry \""
|
<< (type == GAME ? "file" : "folder") << " entry \""
|
||||||
<< file->getName() << "\""
|
<< file->getName() << "\""
|
||||||
<< " (\"" << file->getPath() << "\")";
|
<< " (\"" << file->getPath() << "\")";
|
||||||
|
FileData* parent {file->getParent()};
|
||||||
delete file;
|
delete file;
|
||||||
|
// In case there are no entries left in the folder.
|
||||||
|
if (parent != system->getRootFolder() && parent->getChildren().empty())
|
||||||
|
delete parent;
|
||||||
}
|
}
|
||||||
// Also delete any folders which are empty, i.e. all their entries are hidden.
|
// Also delete any folders which are empty, i.e. all their entries are hidden.
|
||||||
else if (file->getType() == FOLDER && file->getChildren().size() == 0) {
|
else if (file->getType() == FOLDER && file->getChildren().size() == 0) {
|
||||||
|
|
Loading…
Reference in a new issue