summaryrefslogtreecommitdiff
path: root/modules/minimp3/resource_importer_mp3.cpp
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-03-23 11:08:58 +0200
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-04-11 13:28:51 +0300
commit9381acb6a42da653cb6dfd9e610dfccead11aa98 (patch)
tree7c781fabd1f496345ca73cc362a5f88060af0fde /modules/minimp3/resource_importer_mp3.cpp
parentca9372622f331f26daf38086a31c4eeea768e540 (diff)
Make FileAccess and DirAccess classes reference counted.
Diffstat (limited to 'modules/minimp3/resource_importer_mp3.cpp')
-rw-r--r--modules/minimp3/resource_importer_mp3.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/modules/minimp3/resource_importer_mp3.cpp b/modules/minimp3/resource_importer_mp3.cpp
index 0e0da806bf..6cd710e792 100644
--- a/modules/minimp3/resource_importer_mp3.cpp
+++ b/modules/minimp3/resource_importer_mp3.cpp
@@ -75,9 +75,8 @@ Error ResourceImporterMP3::import(const String &p_source_file, const String &p_s
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(!f, ERR_CANT_OPEN);
+ Ref<FileAccess> f = FileAccess::open(p_source_file, FileAccess::READ);
+ ERR_FAIL_COND_V(f.is_null(), ERR_CANT_OPEN);
uint64_t len = f->get_length();
@@ -87,8 +86,6 @@ Error ResourceImporterMP3::import(const String &p_source_file, const String &p_s
f->get_buffer(w, len);
- memdelete(f);
-
Ref<AudioStreamMP3> mp3_stream;
mp3_stream.instantiate();