You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +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:
@@ -44,7 +44,7 @@
|
||||
|
||||
void ExportTemplateManager::_update_template_status() {
|
||||
// Fetch installed templates from the file system.
|
||||
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||
DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||
const String &templates_dir = EditorSettings::get_singleton()->get_templates_dir();
|
||||
|
||||
Error err = da->change_dir(templates_dir);
|
||||
@@ -62,7 +62,6 @@ void ExportTemplateManager::_update_template_status() {
|
||||
}
|
||||
}
|
||||
da->list_dir_end();
|
||||
memdelete(da);
|
||||
|
||||
// Update the state of the current version.
|
||||
String current_version = VERSION_FULL_CONFIG;
|
||||
|
||||
Reference in New Issue
Block a user