mirror of
https://github.com/glest/glest-source.git
synced 2025-08-18 06:01:17 +02:00
- fixed a bunch of memory leaks that will hopefully mean less overall memory requirements.
This commit is contained in:
@@ -83,6 +83,9 @@ ParticleSystem::~ParticleSystem(){
|
||||
|
||||
//delete [] particles;
|
||||
particles.clear();
|
||||
|
||||
delete particleObserver;
|
||||
particleObserver = NULL;
|
||||
}
|
||||
|
||||
// =============== VIRTUAL ======================
|
||||
|
@@ -271,17 +271,21 @@ SystemFlags::SystemFlags() {
|
||||
|
||||
}
|
||||
|
||||
void SystemFlags::globalCleanupHTTP() {
|
||||
if(SystemFlags::curl_global_init_called == true) {
|
||||
SystemFlags::curl_global_init_called = false;
|
||||
curl_global_cleanup();
|
||||
//printf("In [%s::%s Line %d] curl_global_cleanup called\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
void SystemFlags::cleanupHTTP(CURL **handle, bool globalCleanup) {
|
||||
if(handle != NULL && *handle != NULL) {
|
||||
curl_easy_cleanup(*handle);
|
||||
*handle = NULL;
|
||||
|
||||
if(globalCleanup == true) {
|
||||
if(SystemFlags::curl_global_init_called == true) {
|
||||
SystemFlags::curl_global_init_called = false;
|
||||
curl_global_cleanup();
|
||||
//printf("In [%s::%s Line %d] curl_global_cleanup called\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
SystemFlags::globalCleanupHTTP();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -297,9 +301,7 @@ SystemFlags::~SystemFlags() {
|
||||
curl_handle = NULL;
|
||||
}
|
||||
if(SystemFlags::curl_global_init_called == true) {
|
||||
SystemFlags::curl_global_init_called = false;
|
||||
curl_global_cleanup();
|
||||
//printf("In [%s::%s Line %d] curl_global_cleanup called\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
SystemFlags::globalCleanupHTTP();
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
@@ -373,6 +375,8 @@ void SystemFlags::Close() {
|
||||
}
|
||||
}
|
||||
|
||||
SystemFlags::globalCleanupHTTP();
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
|
@@ -65,6 +65,8 @@ bool XmlIo::initialized= false;
|
||||
XmlIo::XmlIo() {
|
||||
try{
|
||||
XMLPlatformUtils::Initialize();
|
||||
|
||||
XmlIo::initialized= true;
|
||||
}
|
||||
catch(const XMLException &e){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error initializing XML system, msg %s\n",__FILE__,__FUNCTION__,__LINE__,e.getMessage());
|
||||
@@ -83,13 +85,20 @@ XmlIo::XmlIo() {
|
||||
}
|
||||
}
|
||||
|
||||
XmlIo &XmlIo::getInstance(){
|
||||
XmlIo &XmlIo::getInstance() {
|
||||
static XmlIo XmlIo;
|
||||
return XmlIo;
|
||||
}
|
||||
|
||||
XmlIo::~XmlIo(){
|
||||
XMLPlatformUtils::Terminate();
|
||||
void XmlIo::cleanup() {
|
||||
if(XmlIo::initialized == true) {
|
||||
XmlIo::initialized= false;
|
||||
XMLPlatformUtils::Terminate();
|
||||
}
|
||||
}
|
||||
|
||||
XmlIo::~XmlIo() {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
XmlNode *XmlIo::load(const string &path, std::map<string,string> mapTagReplacementValues) {
|
||||
|
Reference in New Issue
Block a user