diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index 047b27cf823..72a7c76f617 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -176,7 +176,6 @@ bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, uint6 Package pkg; pkg.filename = p_path; - pkg.zfile = zfile; packages.push_back(pkg); int pkg_num = packages.size() - 1; @@ -203,6 +202,8 @@ bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, uint6 } } + unzClose(zfile); + return true; } @@ -227,10 +228,6 @@ ZipArchive::ZipArchive() { } ZipArchive::~ZipArchive() { - for (int i = 0; i < packages.size(); i++) { - unzClose(packages[i].zfile); - } - packages.clear(); } diff --git a/core/io/file_access_zip.h b/core/io/file_access_zip.h index a1544feefa3..6d4a181ff15 100644 --- a/core/io/file_access_zip.h +++ b/core/io/file_access_zip.h @@ -48,7 +48,6 @@ public: private: struct Package { String filename; - unzFile zfile = nullptr; }; Vector packages;