From b63c506ad8499ff5ac1fd8f76296112a1274717d Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 4 Mar 2019 09:52:15 -0300 Subject: [PATCH] Close file handles after use of new get_as_utf8_strings, fixes #26578 --- modules/gdscript/gdscript.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index b316ed6e58f6..670aabc34c11 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 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 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 *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();