mirror of https://github.com/x64dbg/TitanEngine
fixed the most ugly bug ever (handle leaks...)
This commit is contained in:
parent
8ca6c8d869
commit
cbe59495aa
|
|
@ -7,8 +7,8 @@ MutexLocker::MutexLocker(const char* name)
|
||||||
int len=strlen(name);
|
int len=strlen(name);
|
||||||
DynBuf newNameBuf(len+20);
|
DynBuf newNameBuf(len+20);
|
||||||
char* newName = (char*)newNameBuf.GetPtr();
|
char* newName = (char*)newNameBuf.GetPtr();
|
||||||
sprintf(newName, "%s%X", name, GetCurrentProcessId());
|
sprintf(newName, "Local\\%s%X", name, GetCurrentProcessId());
|
||||||
gMutex=CreateMutexA(0, false, newName);
|
gMutex=CreateMutexA(0, true, newName);
|
||||||
bUnlocked=false;
|
bUnlocked=false;
|
||||||
WaitForSingleObject(gMutex, INFINITE);
|
WaitForSingleObject(gMutex, INFINITE);
|
||||||
}
|
}
|
||||||
|
|
@ -17,6 +17,7 @@ MutexLocker::~MutexLocker()
|
||||||
{
|
{
|
||||||
if(!bUnlocked)
|
if(!bUnlocked)
|
||||||
ReleaseMutex(gMutex);
|
ReleaseMutex(gMutex);
|
||||||
|
CloseHandle(gMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MutexLocker::relock()
|
void MutexLocker::relock()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue