1
0
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:
Rémi Verschelde
2022-03-10 15:27:09 +01:00
parent 259114e9e0
commit 768f9422bc
28 changed files with 154 additions and 259 deletions

View File

@@ -50,7 +50,7 @@ void PluginConfigDialog::_on_confirmed() {
String path = "res://addons/" + subfolder_edit->get_text();
if (!_edit_mode) {
DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
DirAccessRef d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
if (!d || d->make_dir_recursive(path) != OK) {
return;
}