Win: Don't write a text crash dump if the log is already closed

Assertion failures or crashes during process shutdown must not write to
the log file if it is already closed, or the debugging CRT will raise
another assertion.
issue1247
Nicolas Hake 2015-02-16 18:14:29 +01:00
parent c809ab4ae3
commit 04df02c9df
1 changed files with 4 additions and 2 deletions

View File

@ -429,7 +429,8 @@ LONG WINAPI GenerateDump(EXCEPTION_POINTERS* pExceptionPointers)
}
// Write dump (human readable format)
SafeTextDump(pExceptionPointers, GetLogFD(), filename);
if (GetLogFD() != -1)
SafeTextDump(pExceptionPointers, GetLogFD(), filename);
if (file != INVALID_HANDLE_VALUE)
{
@ -569,7 +570,8 @@ namespace {
eptr.ExceptionRecord = &erec;
// Log
SafeTextDump(&eptr, GetLogFD(), nullptr);
if (GetLogFD() != -1)
SafeTextDump(&eptr, GetLogFD(), nullptr);
// Continue caller
if (ResumeThread(data->thread) == -1)