Fixed memory leak in AssetFile

This commit is contained in:
Simon Lübeß
2023-12-25 16:30:58 +01:00
parent abb119589c
commit 20814a61b6
2 changed files with 4 additions and 6 deletions
+4 -4
View File
@@ -26,9 +26,9 @@ class AssetFile
{ {
private EditorContentManager _contentManager; private EditorContentManager _contentManager;
private String _path; private String _path ~ delete:append _;
private String _identifier; private String _identifier ~ delete:append _;
private String _assetConfigPath ~ delete _; private String _assetConfigPath ~ delete:append _;
private AssetConfig _assetConfig ~ delete _; private AssetConfig _assetConfig ~ delete _;
@@ -53,7 +53,7 @@ class AssetFile
{ {
String identifierBuffer = append String(identifier); String identifierBuffer = append String(identifier);
String pathBuffer = append String(path); String pathBuffer = append String(path);
String configPathBuffer = new String(path.Length + ConfigFileExtension.Length); String configPathBuffer = append String(path.Length + ConfigFileExtension.Length);
_identifier = identifierBuffer; _identifier = identifierBuffer;
_path = pathBuffer; _path = pathBuffer;
@@ -673,14 +673,12 @@ class AssetHierarchy
// Directories have no AssetFile? // Directories have no AssetFile?
if (node->AssetFile != null) if (node->AssetFile != null)
{ {
// TODO: Somehow this leaks memory
node->AssetFile.[Friend]_path.Set(node->Path); node->AssetFile.[Friend]_path.Set(node->Path);
node->AssetFile.[Friend]_identifier.Set(newFilePath); node->AssetFile.[Friend]_identifier.Set(newFilePath);
AssetIdentifier.Fixup(node->AssetFile.[Friend]_identifier); AssetIdentifier.Fixup(node->AssetFile.[Friend]_identifier);
node->AssetFile.[Friend]_assetConfigPath.Set(node->Path); node->AssetFile.[Friend]_assetConfigPath.Set(node->Path);
// TODO: Somehow this leaks memory
node->AssetFile.[Friend]_assetConfigPath.Append(AssetFile.ConfigFileExtension); node->AssetFile.[Friend]_assetConfigPath.Append(AssetFile.ConfigFileExtension);
} }