diff options
author | Juan Linietsky <juan@godotengine.org> | 2019-03-04 09:52:15 -0300 |
---|---|---|
committer | Juan Linietsky <juan@godotengine.org> | 2019-03-04 09:53:02 -0300 |
commit | b63c506ad8499ff5ac1fd8f76296112a1274717d (patch) | |
tree | e3671e4b088a6a6c530f1c096e3737ca48efd06c | |
parent | 5cfedd46ce8432f6b608795cbfa51c4645b14e8c (diff) |
Close file handles after use of new get_as_utf8_strings, fixes #26578
-rw-r--r-- | modules/gdscript/gdscript.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index b316ed6e58..670aabc34c 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -1835,7 +1835,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b PoolVector<uint8_t> sourcef; Error err; - FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err); + FileAccessRef f = FileAccess::open(p_path, FileAccess::READ, &err); if (err) { return String(); } @@ -1869,11 +1869,12 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b } else { Vector<StringName> extend_classes = subclass->extends_class; - FileAccess *subfile = FileAccess::open(subclass->extends_file, FileAccess::READ); + FileAccessRef subfile = FileAccess::open(subclass->extends_file, FileAccess::READ); if (!subfile) { break; } String subsource = subfile->get_as_utf8_string(); + if (subsource.empty()) { break; } @@ -2203,7 +2204,7 @@ String ResourceFormatLoaderGDScript::get_resource_type(const String &p_path) con void ResourceFormatLoaderGDScript::get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types) { - FileAccess *file = FileAccess::open(p_path, FileAccess::READ); + FileAccessRef file = FileAccess::open(p_path, FileAccess::READ); ERR_FAIL_COND(!file); String source = file->get_as_utf8_string(); |