fixed the most ugly bug ever (handle leaks...)

This commit is contained in:
Mr. eXoDia 2014-05-10 15:00:59 +02:00
parent 8ca6c8d869
commit cbe59495aa
1 changed files with 3 additions and 2 deletions

View File

@ -7,8 +7,8 @@ MutexLocker::MutexLocker(const char* name)
int len=strlen(name);
DynBuf newNameBuf(len+20);
char* newName = (char*)newNameBuf.GetPtr();
sprintf(newName, "%s%X", name, GetCurrentProcessId());
gMutex=CreateMutexA(0, false, newName);
sprintf(newName, "Local\\%s%X", name, GetCurrentProcessId());
gMutex=CreateMutexA(0, true, newName);
bUnlocked=false;
WaitForSingleObject(gMutex, INFINITE);
}
@ -17,6 +17,7 @@ MutexLocker::~MutexLocker()
{
if(!bUnlocked)
ReleaseMutex(gMutex);
CloseHandle(gMutex);
}
void MutexLocker::relock()