From 680bcef82546fa0f50b431f20423b62621d1c5ac Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Wed, 23 Mar 2022 13:53:32 +0800 Subject: Fix crash when exporting projects with shared libraries --- core/io/dir_access.h | 4 ++++ core/io/file_access.h | 4 ++++ editor/editor_export.cpp | 1 - 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/io/dir_access.h b/core/io/dir_access.h index d63453e947..b97d097842 100644 --- a/core/io/dir_access.h +++ b/core/io/dir_access.h @@ -137,6 +137,10 @@ struct DirAccessRef { DirAccess *f = nullptr; DirAccessRef(DirAccess *fa) { f = fa; } + DirAccessRef(DirAccessRef &&other) { + f = other.f; + other.f = nullptr; + } ~DirAccessRef() { if (f) { memdelete(f); diff --git a/core/io/file_access.h b/core/io/file_access.h index 5413665440..a6cb5d9fc6 100644 --- a/core/io/file_access.h +++ b/core/io/file_access.h @@ -188,6 +188,10 @@ struct FileAccessRef { operator FileAccess *() { return f; } FileAccessRef(FileAccess *fa) { f = fa; } + FileAccessRef(FileAccessRef &&other) { + f = other.f; + other.f = nullptr; + } ~FileAccessRef() { if (f) { memdelete(f); diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index afb5bd9d4d..bbc104301d 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -1878,7 +1878,6 @@ Error EditorExportPlatformPC::export_project(const Ref &p_pr if (err == OK && !so_files.is_empty()) { // If shared object files, copy them. - da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); for (int i = 0; i < so_files.size() && err == OK; i++) { String src_path = ProjectSettings::get_singleton()->globalize_path(so_files[i].path); String target_path; -- cgit v1.2.3