summaryrefslogtreecommitdiff
path: root/core/io/file_access_pack.cpp
diff options
context:
space:
mode:
authorAnton Yabchinskiy <arn@bestmx.ru>2015-07-29 23:01:36 +0300
committerAnton Yabchinskiy <arn@bestmx.ru>2015-07-29 23:01:36 +0300
commitdc8df8a91a995796f0f330bf6bb6b209f6dfce08 (patch)
tree46cfe09124703b07860754d6b44e0289422e0573 /core/io/file_access_pack.cpp
parent16746f157f83d666079ba3266acec13d35b84c3f (diff)
parent922356b903061cda7591090bf19e8346c3a78cf5 (diff)
Merge branch 'master' of github.com:okamstudio/godot
Diffstat (limited to 'core/io/file_access_pack.cpp')
-rw-r--r--core/io/file_access_pack.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index afbd7e3d46..339a6d0528 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -92,7 +92,9 @@ void PackedData::add_path(const String& pkg_path, const String& path, uint64_t o
void PackedData::add_pack_source(PackSource *p_source) {
- sources.push_back(p_source);
+ if (p_source != NULL) {
+ sources.push_back(p_source);
+ }
};
PackedData *PackedData::singleton=NULL;
@@ -107,6 +109,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);
+}
+
//////////////////////////////////////////////////////////////////