Fix crash when exporting projects with shared libraries

This commit is contained in:
Haoyu Qiu 2022-03-23 13:53:32 +08:00
parent 3586f559d1
commit 680bcef825
3 changed files with 8 additions and 1 deletions

View file

@ -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);

View file

@ -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);

View file

@ -1878,7 +1878,6 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &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;