From 4bf99f4af2c4918883c4382ead7de275fae21eea Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 12 Apr 2022 10:12:40 +0300 Subject: Narrow FileAccess scope to prevent deadlocks. --- core/io/file_access_compressed.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/io/file_access_compressed.cpp') diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp index 0c961ba8fb..ebd729cc64 100644 --- a/core/io/file_access_compressed.cpp +++ b/core/io/file_access_compressed.cpp @@ -63,7 +63,7 @@ Error FileAccessCompressed::open_after_magic(Ref p_base) { cmode = (Compression::Mode)f->get_32(); block_size = f->get_32(); if (block_size == 0) { - f = Ref(); + f.unref(); ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Can't open compressed file '" + p_base->get_path() + "' with block size 0, it is corrupted."); } read_total = f->get_32(); @@ -106,7 +106,7 @@ Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) { f = FileAccess::open(p_path, p_mode_flags, &err); if (err != OK) { //not openable - f = Ref(); + f.unref(); return err; } @@ -126,7 +126,7 @@ Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) { rmagic[4] = 0; err = ERR_FILE_UNRECOGNIZED; if (magic != rmagic || (err = open_after_magic(f)) != OK) { - f = Ref(); + f.unref(); return err; } } @@ -180,7 +180,7 @@ void FileAccessCompressed::close() { buffer.clear(); read_blocks.clear(); } - f = Ref(); + f.unref(); } bool FileAccessCompressed::is_open() const { -- cgit v1.2.3