diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-03-23 11:08:58 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-04-11 13:28:51 +0300 |
commit | 9381acb6a42da653cb6dfd9e610dfccead11aa98 (patch) | |
tree | 7c781fabd1f496345ca73cc362a5f88060af0fde /modules/vorbis | |
parent | ca9372622f331f26daf38086a31c4eeea768e540 (diff) |
Make FileAccess and DirAccess classes reference counted.
Diffstat (limited to 'modules/vorbis')
-rw-r--r-- | modules/vorbis/resource_importer_ogg_vorbis.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/modules/vorbis/resource_importer_ogg_vorbis.cpp b/modules/vorbis/resource_importer_ogg_vorbis.cpp index d12e65a96a..03e145216a 100644 --- a/modules/vorbis/resource_importer_ogg_vorbis.cpp +++ b/modules/vorbis/resource_importer_ogg_vorbis.cpp @@ -78,9 +78,8 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin bool loop = p_options["loop"]; float loop_offset = p_options["loop_offset"]; - FileAccess *f = FileAccess::open(p_source_file, FileAccess::READ); - - ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, "Cannot open file '" + p_source_file + "'."); + Ref<FileAccess> f = FileAccess::open(p_source_file, FileAccess::READ); + ERR_FAIL_COND_V_MSG(f.is_null(), ERR_CANT_OPEN, "Cannot open file '" + p_source_file + "'."); uint64_t len = f->get_length(); @@ -90,8 +89,6 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin f->get_buffer(w, len); - memdelete(f); - Ref<AudioStreamOGGVorbis> ogg_vorbis_stream; ogg_vorbis_stream.instantiate(); |