You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Convert uses of DirAccess * to DirAccessRef to prevent memleaks
`DirAccess *` needs to be deleted manually, and this is often forgotten especially when doing early returns with `ERR_FAIL_COND`. `DirAccessRef` is deleted automatically when it goes out of scope. Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
This commit is contained in:
@@ -1094,12 +1094,11 @@ void EditorFileSystem::_delete_internal_files(String p_file) {
|
||||
if (FileAccess::exists(p_file + ".import")) {
|
||||
List<String> paths;
|
||||
ResourceFormatImporter::get_singleton()->get_internal_resource_path_list(p_file, &paths);
|
||||
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||
DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||
for (const String &E : paths) {
|
||||
da->remove(E);
|
||||
}
|
||||
da->remove(p_file + ".import");
|
||||
memdelete(da);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user