mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 11:42:31 +01:00
attempt to fix segfaults discovered during testing
This commit is contained in:
parent
24f3a1d6de
commit
7966422582
@ -728,7 +728,6 @@ void MainWindow::onClose(wxCloseEvent &event){
|
||||
if(glCanvas) glCanvas->Destroy();
|
||||
glCanvas = NULL;
|
||||
|
||||
//delete this;
|
||||
this->Destroy();
|
||||
}
|
||||
|
||||
|
@ -248,9 +248,6 @@ void MainMenu::setState(MenuState *newstate) {
|
||||
|
||||
//printf("In MainMenu::setState() #1\n");
|
||||
|
||||
//delete this->state;
|
||||
//this->state = newstate;
|
||||
|
||||
if(oldstate != NULL && oldstate != newstate) {
|
||||
MenuState *oldstatePtr = oldstate;
|
||||
delete oldstate;
|
||||
|
@ -1784,6 +1784,8 @@ void ServerInterface::waitUntilReady(Checksum *checksum) {
|
||||
MAX_LOOP_COUNT_BEFORE_SLEEP = Config::getInstance().getInt("NetworkServerLoopGameLoadingCap",intToStr(MAX_LOOP_COUNT_BEFORE_SLEEP).c_str());
|
||||
int sleepMillis = Config::getInstance().getInt("NetworkServerLoopGameLoadingCapSleepMillis","10");
|
||||
|
||||
int64 lastStatusUpdate = 0;
|
||||
|
||||
while(exitServer == false && allReady == false && logger.getCancelLoading() == false) {
|
||||
waitLoopIterationCount++;
|
||||
if(waitLoopIterationCount > 0 && waitLoopIterationCount % MAX_LOOP_COUNT_BEFORE_SLEEP == 0) {
|
||||
@ -1844,7 +1846,10 @@ void ServerInterface::waitUntilReady(Checksum *checksum) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if(chrono.getMillis() % 100 == 0) {
|
||||
//if(chrono.getMillis() % 100 == 0) {
|
||||
if(chrono.getMillis() - lastStatusUpdate > 200) {
|
||||
lastStatusUpdate = chrono.getMillis();
|
||||
|
||||
string waitForHosts = "";
|
||||
for(int i = 0; i < waitingForHosts.size(); i++) {
|
||||
if(waitForHosts != "") {
|
||||
|
@ -445,7 +445,6 @@ void MainWindow::onClose(wxCloseEvent &event) {
|
||||
if(glCanvas) glCanvas->Destroy();
|
||||
glCanvas = NULL;
|
||||
|
||||
//delete this;
|
||||
this->Destroy();
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ void BaseThread::setDeleteSelfOnExecutionDone(bool value) {
|
||||
void BaseThread::deleteSelfIfRequired() {
|
||||
if(getDeleteSelfOnExecutionDone() == true) {
|
||||
if(isThreadDeleted(this->ptr) == false) {
|
||||
delete this;
|
||||
this->setDeleteAfterExecute(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ void SimpleTaskThread::execute() {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(isThreadDeleted(ptr_cpy) == false) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
delete this;
|
||||
this->setDeleteAfterExecute(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -608,7 +608,7 @@ void LogFileThread::execute() {
|
||||
if(mustDeleteSelf == true) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] LogFile thread is deleting self\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(isThreadDeleted(ptr_cpy) == false) {
|
||||
delete this;
|
||||
this->setDeleteAfterExecute(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -855,7 +855,6 @@ void IRCThread::execute() {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In IRCThread() calling delete ...\n");
|
||||
|
||||
//printf("In ~IRCThread Line: %d [%p]\n",__LINE__,this);
|
||||
//delete this;
|
||||
setDeleteAfterExecute(true);
|
||||
}
|
||||
|
||||
|
@ -1214,7 +1214,6 @@ void FTPClientThread::execute() {
|
||||
|
||||
// Delete ourself when the thread is done (no other actions can happen after this
|
||||
// such as the mutex which modifies the running status of this method
|
||||
//delete this;
|
||||
deleteSelfIfRequired();
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ vector<Thread *> Thread::threadList;
|
||||
auto_ptr<Mutex> Mutex::mutexMutexList(new Mutex(CODE_AT_LINE));
|
||||
vector<Mutex *> Mutex::mutexList;
|
||||
|
||||
class ThreadAutoCleanup : public BaseThread
|
||||
class ThreadGarbageCollector : public BaseThread
|
||||
{
|
||||
protected:
|
||||
Mutex mutexPendingCleanupList;
|
||||
@ -48,10 +48,10 @@ protected:
|
||||
return false;
|
||||
}
|
||||
public:
|
||||
ThreadAutoCleanup() : BaseThread() {
|
||||
ThreadGarbageCollector() : BaseThread() {
|
||||
removeThreadFromList();
|
||||
}
|
||||
virtual ~ThreadAutoCleanup() {
|
||||
virtual ~ThreadGarbageCollector() {
|
||||
//printf("In ~ThreadAutoCleanup Line: %d\n",__LINE__);
|
||||
}
|
||||
virtual void execute() {
|
||||
@ -72,7 +72,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static auto_ptr<ThreadAutoCleanup> cleanupThread;
|
||||
static auto_ptr<ThreadGarbageCollector> cleanupThread;
|
||||
// =====================================
|
||||
// Threads
|
||||
// =====================================
|
||||
@ -194,7 +194,7 @@ void Thread::queueAutoCleanThread() {
|
||||
|
||||
if(cleanupThread.get() == NULL) {
|
||||
//printf("In Thread::shutdownThreads Line: %d\n",__LINE__);
|
||||
cleanupThread.reset(new ThreadAutoCleanup());
|
||||
cleanupThread.reset(new ThreadGarbageCollector());
|
||||
cleanupThread->start();
|
||||
sleep(0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user