mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 19:29:09 +00:00
Fix deadlock if plCrashHandler is not running
Only wait for the crash server to do its job if it's attached. Silent failures are evil, but it's better than hanging forever.
This commit is contained in:
@ -134,5 +134,7 @@ void plCrashCli::ReportCrash(PEXCEPTION_POINTERS e)
|
|||||||
|
|
||||||
void plCrashCli::WaitForHandle()
|
void plCrashCli::WaitForHandle()
|
||||||
{
|
{
|
||||||
fHandled->Wait();
|
// Don't deadlock... Only wait if the CrashSrv is attached
|
||||||
|
if (fLink && fLink->fSrvReady)
|
||||||
|
fHandled->Wait();
|
||||||
}
|
}
|
||||||
|
@ -108,10 +108,11 @@ void plCrashSrv::IHandleCrash()
|
|||||||
|
|
||||||
void plCrashSrv::HandleCrash()
|
void plCrashSrv::HandleCrash()
|
||||||
{
|
{
|
||||||
#ifdef HS_BUILD_FOR_WIN32
|
|
||||||
if (!fLink)
|
if (!fLink)
|
||||||
FATAL("plCrashMemLink is nil!");
|
FATAL("plCrashMemLink is nil!");
|
||||||
|
fLink->fSrvReady = true; // mark us as ready to receive crashes
|
||||||
|
|
||||||
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
// In Win32 land we have to hackily handle the client process exiting, so we'll wait on both
|
// In Win32 land we have to hackily handle the client process exiting, so we'll wait on both
|
||||||
// the crashed semaphore and the client process...
|
// the crashed semaphore and the client process...
|
||||||
HANDLE hack[2] = { fLink->fClientProcess, fCrashed->GetHandle() };
|
HANDLE hack[2] = { fLink->fClientProcess, fCrashed->GetHandle() };
|
||||||
@ -119,8 +120,6 @@ void plCrashSrv::HandleCrash()
|
|||||||
hsAssert(result != WAIT_FAILED, "WaitForMultipleObjects failed");
|
hsAssert(result != WAIT_FAILED, "WaitForMultipleObjects failed");
|
||||||
#else
|
#else
|
||||||
fCrashed->Wait();
|
fCrashed->Wait();
|
||||||
if (!fLink)
|
|
||||||
FATAL("plCrashMemLink is nil!");
|
|
||||||
#endif
|
#endif
|
||||||
if (fLink->fCrashed)
|
if (fLink->fCrashed)
|
||||||
IHandleCrash();
|
IHandleCrash();
|
||||||
|
@ -59,6 +59,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
struct plCrashMemLink
|
struct plCrashMemLink
|
||||||
{
|
{
|
||||||
bool fCrashed;
|
bool fCrashed;
|
||||||
|
bool fSrvReady;
|
||||||
#ifdef HS_BUILD_FOR_WIN32
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
HANDLE fClientProcess;
|
HANDLE fClientProcess;
|
||||||
uint32_t fClientProcessID;
|
uint32_t fClientProcessID;
|
||||||
|
Reference in New Issue
Block a user