Improved handling of fatal/critical messages in lamexp_message_handler() function.
This commit is contained in:
parent
fb00b2b11e
commit
bf34e9e78f
@ -140,8 +140,7 @@ copy /Y "$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\bin\Win32\*.manifes
|
|||||||
<CreateHotpatchableImage>false</CreateHotpatchableImage>
|
<CreateHotpatchableImage>false</CreateHotpatchableImage>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<OpenMPSupport>false</OpenMPSupport>
|
<OpenMPSupport>false</OpenMPSupport>
|
||||||
<DebugInformationFormat>
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
</DebugInformationFormat>
|
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
<CompileAsManaged>false</CompileAsManaged>
|
<CompileAsManaged>false</CompileAsManaged>
|
||||||
<AdditionalOptions>/wd4005 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/wd4005 %(AdditionalOptions)</AdditionalOptions>
|
||||||
@ -167,10 +166,10 @@ copy /Y "$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\bin\Win32\*.manifes
|
|||||||
<EntryPointSymbol>lamexp_entry_point</EntryPointSymbol>
|
<EntryPointSymbol>lamexp_entry_point</EntryPointSymbol>
|
||||||
<MapFileName>
|
<MapFileName>
|
||||||
</MapFileName>
|
</MapFileName>
|
||||||
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
|
|
||||||
<CreateHotPatchableImage>
|
<CreateHotPatchableImage>
|
||||||
</CreateHotPatchableImage>
|
</CreateHotPatchableImage>
|
||||||
<AdditionalLibraryDirectories>$(QTDIR)\lib;$(QTDIR)\plugins\imageformats;$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\lib\Win32;$(SolutionDir)\etc\Prerequisites\keccak\lib\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(QTDIR)\lib;$(QTDIR)\plugins\imageformats;$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\lib\Win32;$(SolutionDir)\etc\Prerequisites\keccak\lib\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
|
||||||
</Link>
|
</Link>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Message>Copy plugin DLL%27s</Message>
|
<Message>Copy plugin DLL%27s</Message>
|
||||||
|
@ -523,8 +523,14 @@ static void lamexp_console_color(FILE* file, WORD attributes)
|
|||||||
*/
|
*/
|
||||||
void lamexp_message_handler(QtMsgType type, const char *msg)
|
void lamexp_message_handler(QtMsgType type, const char *msg)
|
||||||
{
|
{
|
||||||
|
static volatile bool bFatalFlag = false;
|
||||||
static const char *GURU_MEDITATION = "\n\nGURU MEDITATION !!!\n\n";
|
static const char *GURU_MEDITATION = "\n\nGURU MEDITATION !!!\n\n";
|
||||||
|
|
||||||
|
if(bFatalFlag || (msg == NULL))
|
||||||
|
{
|
||||||
|
return; //We are about to terminate, discard any further messages!
|
||||||
|
}
|
||||||
|
|
||||||
QMutexLocker lock(&g_lamexp_message_mutex);
|
QMutexLocker lock(&g_lamexp_message_mutex);
|
||||||
|
|
||||||
if(g_lamexp_log_file)
|
if(g_lamexp_log_file)
|
||||||
@ -546,6 +552,7 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
|
|||||||
{
|
{
|
||||||
case QtCriticalMsg:
|
case QtCriticalMsg:
|
||||||
case QtFatalMsg:
|
case QtFatalMsg:
|
||||||
|
bFatalFlag = true;
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
lamexp_console_color(stderr, FOREGROUND_RED | FOREGROUND_INTENSITY);
|
lamexp_console_color(stderr, FOREGROUND_RED | FOREGROUND_INTENSITY);
|
||||||
@ -590,7 +597,7 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
|
|||||||
OutputDebugStringA(temp.toLatin1().constData());
|
OutputDebugStringA(temp.toLatin1().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type == QtCriticalMsg || type == QtFatalMsg)
|
if(bFatalFlag)
|
||||||
{
|
{
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user