- bugfix for segfault in menu when exiting too fast

This commit is contained in:
Mark Vejvoda
2012-03-05 22:53:03 +00:00
parent 7399d10247
commit 623623d33f
5 changed files with 61 additions and 17 deletions

View File

@@ -296,6 +296,8 @@ SimpleTaskThread::SimpleTaskThread( SimpleTaskCallbackInterface *simpleTaskInter
this->executionCount = executionCount;
this->millisecsBetweenExecutions = millisecsBetweenExecutions;
this->needTaskSignal = needTaskSignal;
this->overrideShutdownTask = NULL;
setTaskSignalled(false);
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
@@ -308,10 +310,7 @@ SimpleTaskThread::SimpleTaskThread( SimpleTaskCallbackInterface *simpleTaskInter
SimpleTaskThread::~SimpleTaskThread() {
try {
if(this->simpleTaskInterface != NULL) {
this->simpleTaskInterface->shutdownTask(this);
this->simpleTaskInterface = NULL;
}
cleanup();
}
catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
@@ -322,6 +321,21 @@ SimpleTaskThread::~SimpleTaskThread() {
}
}
void SimpleTaskThread::cleanup() {
if(this->overrideShutdownTask != NULL) {
this->overrideShutdownTask(this);
this->overrideShutdownTask = NULL;
}
else if(this->simpleTaskInterface != NULL) {
this->simpleTaskInterface->shutdownTask(this);
this->simpleTaskInterface = NULL;
}
}
void SimpleTaskThread::setOverrideShutdownTask(taskFunctionCallback *ptr) {
this->overrideShutdownTask = ptr;
}
bool SimpleTaskThread::isThreadExecutionLagging() {
bool result = false;
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);