summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2022-04-22 18:15:31 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2022-04-22 18:15:31 +0800
commitcaf8e5e3396f7210c11757874e48af641f924c17 (patch)
tree6137d82912243dd4a1122c06cbc04f06e8f40e16 /core
parentf4b0c7a1ea8d86c1dfd96478ca12ad1360903d9d (diff)
Close FileAccess before accessing it with DirAccess
Diffstat (limited to 'core')
-rw-r--r--core/io/resource_format_binary.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 8d4dbc3f73..b6988109c5 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -1153,6 +1153,8 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
uint32_t ver_format = f->get_32();
if (ver_format < FORMAT_VERSION_CAN_RENAME_DEPS) {
+ fw.unref();
+
{
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
da->remove(p_path + ".depren");
@@ -1295,6 +1297,8 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
return ERR_CANT_CREATE;
}
+ fw.unref();
+
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
da->remove(p_path);
da->rename(p_path + ".depren", p_path);