diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-04-12 10:12:40 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-04-12 10:54:39 +0300 |
commit | 4bf99f4af2c4918883c4382ead7de275fae21eea (patch) | |
tree | e741cea7e9395dcffeaa986f34e19819564356fb /platform/uwp/export/export_plugin.h | |
parent | 5974e1432ef7941a5e29f8723dec85aa45505963 (diff) | |
download | redot-engine-4bf99f4af2c4918883c4382ead7de275fae21eea.tar.gz |
Narrow FileAccess scope to prevent deadlocks.
Diffstat (limited to 'platform/uwp/export/export_plugin.h')
-rw-r--r-- | platform/uwp/export/export_plugin.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/platform/uwp/export/export_plugin.h b/platform/uwp/export/export_plugin.h index 7f10b00dc1..ceb6d613b3 100644 --- a/platform/uwp/export/export_plugin.h +++ b/platform/uwp/export/export_plugin.h @@ -346,19 +346,21 @@ class EditorExportPlatformUWP : public EditorExportPlatform { ERR_FAIL_V_MSG(data, err_string); } - Ref<FileAccess> f = FileAccess::open(tmp_path, FileAccess::READ, &err); + { + Ref<FileAccess> f = FileAccess::open(tmp_path, FileAccess::READ, &err); + + if (err != OK) { + String err_string = "Couldn't open temp logo file."; + // Cleanup generated file. + DirAccess::remove_file_or_error(tmp_path); + EditorNode::add_io_error(err_string); + ERR_FAIL_V_MSG(data, err_string); + } - if (err != OK) { - String err_string = "Couldn't open temp logo file."; - // Cleanup generated file. - DirAccess::remove_file_or_error(tmp_path); - EditorNode::add_io_error(err_string); - ERR_FAIL_V_MSG(data, err_string); + data.resize(f->get_length()); + f->get_buffer(data.ptrw(), data.size()); } - data.resize(f->get_length()); - f->get_buffer(data.ptrw(), data.size()); - DirAccess::remove_file_or_error(tmp_path); return data; |