Improved handling of fatal/critical messages in lamexp_message_handler() function.

This commit is contained in:
LoRd_MuldeR 2012-12-08 00:21:58 +01:00
parent fb00b2b11e
commit bf34e9e78f
3 changed files with 12 additions and 6 deletions

View File

@ -140,8 +140,7 @@ copy /Y "$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\bin\Win32\*.manifes
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<OpenMPSupport>false</OpenMPSupport>
<DebugInformationFormat>
</DebugInformationFormat>
<DebugInformationFormat>None</DebugInformationFormat>
<TreatWarningAsError>true</TreatWarningAsError>
<CompileAsManaged>false</CompileAsManaged>
<AdditionalOptions>/wd4005 %(AdditionalOptions)</AdditionalOptions>
@ -167,10 +166,10 @@ copy /Y "$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\bin\Win32\*.manifes
<EntryPointSymbol>lamexp_entry_point</EntryPointSymbol>
<MapFileName>
</MapFileName>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
<CreateHotPatchableImage>
</CreateHotPatchableImage>
<AdditionalLibraryDirectories>$(QTDIR)\lib;$(QTDIR)\plugins\imageformats;$(SolutionDir)\etc\Prerequisites\VisualLeakDetector\lib\Win32;$(SolutionDir)\etc\Prerequisites\keccak\lib\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
</Link>
<PostBuildEvent>
<Message>Copy plugin DLL%27s</Message>

View File

@ -523,8 +523,14 @@ static void lamexp_console_color(FILE* file, WORD attributes)
*/
void lamexp_message_handler(QtMsgType type, const char *msg)
{
static volatile bool bFatalFlag = false;
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);
if(g_lamexp_log_file)
@ -546,6 +552,7 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
{
case QtCriticalMsg:
case QtFatalMsg:
bFatalFlag = true;
fflush(stdout);
fflush(stderr);
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());
}
if(type == QtCriticalMsg || type == QtFatalMsg)
if(bFatalFlag)
{
lock.unlock();

View File

@ -150,7 +150,7 @@ static int lamexp_main(int argc, char* argv[])
FileListModel *fileListModel = new FileListModel();
AudioFileModel *metaInfo = new AudioFileModel();
SettingsModel *settingsModel = new SettingsModel();
//Show splash screen
InitializationThread *poInitializationThread = new InitializationThread(&cpuFeatures);
SplashScreen::showSplash(poInitializationThread);