diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-04-20 19:38:02 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-04-20 19:38:02 -0300 |
commit | 59154cccf9fcf814a21a2596993fb1b6777d3bb7 (patch) | |
tree | 4132620a9d924463dae4b64fea2dde68a14023e7 /core/io | |
parent | 28c4afeb5733f9ca9725ab2a5f4066af8e02b2a6 (diff) |
-Changed Godot exit to be clean.
-Added more debug information on memory cleanliness on exit (if run with -v)
-Fixed several memory leaks, fixes #1731, fixes #755
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/file_access_network.cpp | 1 | ||||
-rw-r--r-- | core/io/file_access_pack.cpp | 15 | ||||
-rw-r--r-- | core/io/file_access_pack.h | 4 | ||||
-rw-r--r-- | core/io/file_access_zip.cpp | 2 |
4 files changed, 21 insertions, 1 deletions
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index a5ec05c35e..850e055129 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -254,6 +254,7 @@ FileAccessNetworkClient::~FileAccessNetworkClient() { quit=true; sem->post(); Thread::wait_to_finish(thread); + memdelete(thread); } memdelete(blockrequest_mutex); diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 15435a8b61..bf1211f2b3 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -107,6 +107,21 @@ PackedData::PackedData() { add_pack_source(memnew(PackedSourcePCK)); } +void PackedData::_free_packed_dirs(PackedDir *p_dir) { + + for (Map<String,PackedDir*>::Element *E=p_dir->subdirs.front();E;E=E->next()) + _free_packed_dirs(E->get()); + memdelete(p_dir); +} + +PackedData::~PackedData() { + + for(int i=0;i<sources.size();i++) { + memdelete(sources[i]); + } + _free_packed_dirs(root); +} + ////////////////////////////////////////////////////////////////// diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h index aed0f5eb7c..5bf5ad012c 100644 --- a/core/io/file_access_pack.h +++ b/core/io/file_access_pack.h @@ -96,6 +96,8 @@ private: static PackedData *singleton; bool disabled; + void _free_packed_dirs(PackedDir *p_dir); + public: void add_pack_source(PackSource* p_source); @@ -111,6 +113,7 @@ public: _FORCE_INLINE_ bool has_path(const String& p_path); PackedData(); + ~PackedData(); }; class PackSource { @@ -119,6 +122,7 @@ public: virtual bool try_open_pack(const String& p_path)=0; virtual FileAccess* get_file(const String& p_path, PackedData::PackedFile* p_file)=0; + virtual ~PackSource() {} }; class PackedSourcePCK : public PackSource { diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index 55c0dedad9..7a1b6454bd 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -150,7 +150,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const { bool ZipArchive::try_open_pack(const String& p_name) { - printf("opening pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz")); + //printf("opening pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz")); if (p_name.extension().nocasecmp_to("zip") != 0 && p_name.extension().nocasecmp_to("pcz") != 0) return false; |