summaryrefslogtreecommitdiff
path: root/platform/uwp
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-04-12 10:12:40 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-04-12 10:54:39 +0300
commit4bf99f4af2c4918883c4382ead7de275fae21eea (patch)
treee741cea7e9395dcffeaa986f34e19819564356fb /platform/uwp
parent5974e1432ef7941a5e29f8723dec85aa45505963 (diff)
Narrow FileAccess scope to prevent deadlocks.
Diffstat (limited to 'platform/uwp')
-rw-r--r--platform/uwp/export/app_packager.cpp2
-rw-r--r--platform/uwp/export/export_plugin.h22
2 files changed, 13 insertions, 11 deletions
diff --git a/platform/uwp/export/app_packager.cpp b/platform/uwp/export/app_packager.cpp
index 8d09a16653..2f70c3e74c 100644
--- a/platform/uwp/export/app_packager.cpp
+++ b/platform/uwp/export/app_packager.cpp
@@ -457,7 +457,7 @@ void AppxPackager::finish() {
Vector<uint8_t> end_record = make_end_of_central_record();
package->store_buffer(end_record.ptr(), end_record.size());
- package = Ref<FileAccess>();
+ package.unref();
}
AppxPackager::AppxPackager() {}
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;