mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03: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:
@@ -277,10 +277,8 @@ void EditorAssetInstaller::ok_pressed() {
|
||||
dirpath = dirpath.substr(0, dirpath.length() - 1);
|
||||
}
|
||||
|
||||
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||
DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||
da->make_dir(dirpath);
|
||||
memdelete(da);
|
||||
|
||||
} else {
|
||||
Vector<uint8_t> data;
|
||||
data.resize(info.uncompressed_size);
|
||||
|
||||
Reference in New Issue
Block a user