Narrow FileAccess scope to prevent deadlocks.

This commit is contained in:
bruvzg 2022-04-12 10:12:40 +03:00
parent 5974e1432e
commit 4bf99f4af2
29 changed files with 511 additions and 459 deletions

View file

@ -1570,13 +1570,15 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
}
/* write the file */
Ref<FileAccess> f = FileAccess::open(file, FileAccess::WRITE);
if (f.is_null()) {
ERR_PRINT("Can't write '" + file + "'.");
unzClose(src_pkg_zip);
return ERR_CANT_CREATE;
};
f->store_buffer(data.ptr(), data.size());
{
Ref<FileAccess> f = FileAccess::open(file, FileAccess::WRITE);
if (f.is_null()) {
ERR_PRINT("Can't write '" + file + "'.");
unzClose(src_pkg_zip);
return ERR_CANT_CREATE;
};
f->store_buffer(data.ptr(), data.size());
}
#if defined(OSX_ENABLED) || defined(X11_ENABLED)
if (is_execute) {
@ -1714,12 +1716,14 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
_export_additional_assets(dest_dir + binary_name, libraries, assets);
_add_assets_to_project(p_preset, project_file_data, assets);
String project_file_name = dest_dir + binary_name + ".xcodeproj/project.pbxproj";
Ref<FileAccess> f = FileAccess::open(project_file_name, FileAccess::WRITE);
if (f.is_null()) {
ERR_PRINT("Can't write '" + project_file_name + "'.");
return ERR_CANT_CREATE;
};
f->store_buffer(project_file_data.ptr(), project_file_data.size());
{
Ref<FileAccess> f = FileAccess::open(project_file_name, FileAccess::WRITE);
if (f.is_null()) {
ERR_PRINT("Can't write '" + project_file_name + "'.");
return ERR_CANT_CREATE;
};
f->store_buffer(project_file_data.ptr(), project_file_data.size());
}
#ifdef OSX_ENABLED
{