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 /modules/mono/csharp_script.cpp | |
parent | 5974e1432ef7941a5e29f8723dec85aa45505963 (diff) | |
download | redot-engine-4bf99f4af2c4918883c4382ead7de275fae21eea.tar.gz |
Narrow FileAccess scope to prevent deadlocks.
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r-- | modules/mono/csharp_script.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 2a8f7c17c7..02aebb3805 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -3641,14 +3641,16 @@ Error ResourceFormatSaverCSharpScript::save(const String &p_path, const RES &p_r } #endif - Error err; - Ref<FileAccess> file = FileAccess::open(p_path, FileAccess::WRITE, &err); - ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot save C# script file '" + p_path + "'."); + { + Error err; + Ref<FileAccess> file = FileAccess::open(p_path, FileAccess::WRITE, &err); + ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot save C# script file '" + p_path + "'."); - file->store_string(source); + file->store_string(source); - if (file->get_error() != OK && file->get_error() != ERR_FILE_EOF) { - return ERR_CANT_CREATE; + if (file->get_error() != OK && file->get_error() != ERR_FILE_EOF) { + return ERR_CANT_CREATE; + } } #ifdef TOOLS_ENABLED |