- attempt to fix double free bug reported by tomreyn
This commit is contained in:
parent
198fa1d05d
commit
704935c534
|
@ -78,8 +78,7 @@ ClientInterface::ClientInterface() : GameNetworkInterface() {
|
|||
}
|
||||
|
||||
void ClientInterface::shutdownNetworkCommandListThread() {
|
||||
//MutexSafeWrapper safeMutex(masterServerThreadAccessor,CODE_AT_LINE);
|
||||
|
||||
MutexSafeWrapper safeMutex(networkCommandListThreadAccessor,CODE_AT_LINE);
|
||||
if(networkCommandListThread != NULL) {
|
||||
time_t elapsed = time(NULL);
|
||||
this->quit = true;
|
||||
|
@ -94,6 +93,10 @@ void ClientInterface::shutdownNetworkCommandListThread() {
|
|||
networkCommandListThread = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Mutex *tempMutexPtr = networkCommandListThreadAccessor;
|
||||
networkCommandListThreadAccessor = NULL;
|
||||
safeMutex.ReleaseLock(false,true);
|
||||
}
|
||||
|
||||
ClientInterface::~ClientInterface() {
|
||||
|
@ -122,9 +125,6 @@ ClientInterface::~ClientInterface() {
|
|||
delete clientSocket;
|
||||
clientSocket = NULL;
|
||||
|
||||
delete networkCommandListThreadAccessor;
|
||||
networkCommandListThreadAccessor = NULL;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
|
|
|
@ -281,6 +281,7 @@ protected:
|
|||
|
||||
public:
|
||||
GameNetworkInterface();
|
||||
virtual ~GameNetworkInterface(){}
|
||||
|
||||
//message processimg
|
||||
virtual void update()= 0;
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
#endif
|
||||
}
|
||||
}
|
||||
void ReleaseLock(bool keepMutex=false) {
|
||||
void ReleaseLock(bool keepMutex=false,bool deleteMutexOnRelease=false) {
|
||||
if(this->mutex != NULL) {
|
||||
#ifdef DEBUG_MUTEXES
|
||||
if(ownerId != "") {
|
||||
|
@ -182,6 +182,11 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
if(deleteMutexOnRelease == true) {
|
||||
delete this->mutex;
|
||||
this->mutex = NULL;
|
||||
}
|
||||
|
||||
if(keepMutex == false) {
|
||||
this->mutex = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user