mirror of
https://github.com/glest/glest-source.git
synced 2025-08-16 21:33:59 +02:00
- applied some memory leak cleanups
This commit is contained in:
@@ -113,10 +113,20 @@ void cleanupCRCThread() {
|
||||
difftime(time(NULL),elapsed) <= 45;) {
|
||||
//sleep(150);
|
||||
}
|
||||
if(preCacheThread->canShutdown(true)) {
|
||||
if(preCacheThread->canShutdown(false)) {
|
||||
if(preCacheThread->shutdownAndWait() == true) {
|
||||
delete preCacheThread;
|
||||
}
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
else {
|
||||
if(preCacheThread->shutdownAndWait() == true) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
delete preCacheThread;
|
||||
|
||||
//printf("Stopping broadcast thread [%p] - C\n",broadCastThread);
|
||||
}
|
||||
}
|
||||
preCacheThread = NULL;
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
@@ -66,6 +66,9 @@ MainMenu::~MainMenu() {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
delete state;
|
||||
state = NULL;
|
||||
delete oldstate;
|
||||
oldstate = NULL;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
|
@@ -1868,23 +1868,38 @@ ServerSocket::~ServerSocket() {
|
||||
UPNP_Tools::enabledUPNP = false;
|
||||
}
|
||||
|
||||
if(urls.controlURL && urls.ipcondescURL && urls.controlURL_CIF) {
|
||||
FreeUPNPUrls(&urls);
|
||||
}
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
void ServerSocket::stopBroadCastThread() {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//printf("Stopping broadcast thread [%p]\n",broadCastThread);
|
||||
|
||||
if(broadCastThread != NULL) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
if(broadCastThread->canShutdown(true) == true) {
|
||||
//printf("Stopping broadcast thread [%p] - A\n",broadCastThread);
|
||||
|
||||
if(broadCastThread->canShutdown(false) == true) {
|
||||
sleep(0);
|
||||
}
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//printf("Stopping broadcast thread [%p] - B\n",broadCastThread);
|
||||
|
||||
if(broadCastThread->shutdownAndWait() == true) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
delete broadCastThread;
|
||||
}
|
||||
|
||||
//printf("Stopping broadcast thread [%p] - C\n",broadCastThread);
|
||||
}
|
||||
broadCastThread = NULL;
|
||||
//printf("Stopping broadcast thread [%p] - D\n",broadCastThread);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
@@ -1897,6 +1912,9 @@ void ServerSocket::startBroadCastThread() {
|
||||
stopBroadCastThread();
|
||||
|
||||
broadCastThread = new BroadCastSocketThread();
|
||||
|
||||
//printf("Start broadcast thread [%p]\n",broadCastThread);
|
||||
|
||||
broadCastThread->setUniqueID(string(__FILE__) + string("_") + string(__FUNCTION__));
|
||||
broadCastThread->start();
|
||||
|
||||
@@ -2286,10 +2304,12 @@ void UPNP_Tools::NETremRedirects(int ext_port) {
|
||||
//
|
||||
BroadCastSocketThread::BroadCastSocketThread() : BaseThread() {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//printf("new broadcast thread [%p]\n",this);
|
||||
}
|
||||
|
||||
BroadCastSocketThread::~BroadCastSocketThread() {
|
||||
|
||||
//printf("delete broadcast thread [%p]\n",this);
|
||||
}
|
||||
|
||||
bool BroadCastSocketThread::canShutdown(bool deleteSelfIfShutdownDelayed) {
|
||||
|
@@ -320,7 +320,10 @@ void SystemFlags::Close() {
|
||||
//sleep(150);
|
||||
}
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(threadLogger->canShutdown(true)) {
|
||||
// if(threadLogger->canShutdown(false)) {
|
||||
// Sleep(0);
|
||||
// }
|
||||
if(threadLogger->shutdownAndWait() == true) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
delete threadLogger;
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
Reference in New Issue
Block a user