mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +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:
parent
259114e9e0
commit
768f9422bc
28 changed files with 154 additions and 259 deletions
|
@ -749,12 +749,11 @@ void OrphanResourcesDialog::_find_to_delete(TreeItem *p_item, List<String> &path
|
|||
}
|
||||
|
||||
void OrphanResourcesDialog::_delete_confirm() {
|
||||
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||
DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||
for (const String &E : paths) {
|
||||
da->remove(E);
|
||||
EditorFileSystem::get_singleton()->update_file(E);
|
||||
}
|
||||
memdelete(da);
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue