Fix segment violation MINIZIP_ENABLED

This commit is contained in:
Daniel T. Borelli 2015-05-06 20:37:25 -03:00
parent 7156aff160
commit 93095014fd
2 changed files with 16 additions and 5 deletions

View file

@ -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) { 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; PackedData *PackedData::singleton=NULL;

View file

@ -251,7 +251,14 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
packed_data = memnew(PackedData); packed_data = memnew(PackedData);
#ifdef MINIZIP_ENABLED #ifdef MINIZIP_ENABLED
//XXX: always get_singleton() == 0x0
zip_packed_data = ZipArchive::get_singleton(); zip_packed_data = ZipArchive::get_singleton();
//TODO: remove this temporary fix
if (!zip_packed_data) {
zip_packed_data = memnew(ZipArchive);
}
packed_data->add_pack_source(zip_packed_data); packed_data->add_pack_source(zip_packed_data);
#endif #endif
@ -748,10 +755,12 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
if (file_access_network_client) if (file_access_network_client)
memdelete(file_access_network_client); memdelete(file_access_network_client);
#ifdef MINIZIP_ENABLED // Note 1: *zip_packed_data live into *packed_data
if (zip_packed_data) // Note 2: PackedData::~PackedData destroy this.
memdelete( zip_packed_data ); //#ifdef MINIZIP_ENABLED
#endif // if (zip_packed_data)
// memdelete( zip_packed_data );
//#endif
unregister_core_types(); unregister_core_types();