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()
|
||||
{
|
||||
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()
|
||||
{
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
if (!fLink)
|
||||
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
|
||||
// the crashed semaphore and the client process...
|
||||
HANDLE hack[2] = { fLink->fClientProcess, fCrashed->GetHandle() };
|
||||
@ -119,8 +120,6 @@ void plCrashSrv::HandleCrash()
|
||||
hsAssert(result != WAIT_FAILED, "WaitForMultipleObjects failed");
|
||||
#else
|
||||
fCrashed->Wait();
|
||||
if (!fLink)
|
||||
FATAL("plCrashMemLink is nil!");
|
||||
#endif
|
||||
if (fLink->fCrashed)
|
||||
IHandleCrash();
|
||||
|
@ -59,6 +59,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
struct plCrashMemLink
|
||||
{
|
||||
bool fCrashed;
|
||||
bool fSrvReady;
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
HANDLE fClientProcess;
|
||||
uint32_t fClientProcessID;
|
||||
|
Reference in New Issue
Block a user