Merge pull request #60424 from timothyqiu/fa-unref
Close `FileAccess` before accessing it with `DirAccess`
This commit is contained in:
commit
68ee730774
|
@ -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);
|
||||
|
|
|
@ -898,6 +898,8 @@ Error ResourceLoaderText::rename_dependencies(Ref<FileAccess> p_f, const String
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue