Added global exception handler routine.

This commit is contained in:
LoRd_MuldeR 2011-04-17 15:53:28 +02:00
parent 99bd8c28ff
commit 4bb7185a0f
6 changed files with 17 additions and 5 deletions

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 2 #define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 4 #define VER_LAMEXP_PATCH 4
#define VER_LAMEXP_BUILD 445 #define VER_LAMEXP_BUILD 447
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Tools versions // Tools versions

View File

@ -1083,7 +1083,7 @@ void MainWindow::closeButtonClicked(void)
void MainWindow::addFilesButtonClicked(void) void MainWindow::addFilesButtonClicked(void)
{ {
ABORT_IF_BUSY; ABORT_IF_BUSY;
TEMP_HIDE_DROPBOX TEMP_HIDE_DROPBOX
( (
if(lamexp_themes_enabled()) if(lamexp_themes_enabled())

View File

@ -296,6 +296,16 @@ const QDate &lamexp_version_date(void)
return g_lamexp_version_date; return g_lamexp_version_date;
} }
/*
* Global exception handler
*/
LONG WINAPI lamexp_exception_handler(__in struct _EXCEPTION_POINTERS *ExceptionInfo)
{
FatalAppExit(0, L"Unhandeled exception error3, application will exit!");
TerminateProcess(GetCurrentProcess(), -1);
return 0;
}
/* /*
* Qt message handler * Qt message handler
*/ */

View File

@ -84,6 +84,7 @@ const char *lamexp_support_url(void);
void lamexp_init_console(int argc, char* argv[]); void lamexp_init_console(int argc, char* argv[]);
bool lamexp_init_qt(int argc, char* argv[]); bool lamexp_init_qt(int argc, char* argv[]);
int lamexp_init_ipc(void); int lamexp_init_ipc(void);
LONG WINAPI lamexp_exception_handler(__in struct _EXCEPTION_POINTERS *ExceptionInfo);
void lamexp_message_handler(QtMsgType type, const char *msg); void lamexp_message_handler(QtMsgType type, const char *msg);
void lamexp_register_tool(const QString &toolName, LockedFile *file, unsigned int version = 0); void lamexp_register_tool(const QString &toolName, LockedFile *file, unsigned int version = 0);
bool lamexp_check_tool(const QString &toolName); bool lamexp_check_tool(const QString &toolName);

View File

@ -193,13 +193,13 @@ int main(int argc, char* argv[])
} }
else else
{ {
int iResult = -1;
SetUnhandledExceptionFilter(lamexp_exception_handler);
try try
{ {
int iResult = -1;
qInstallMsgHandler(lamexp_message_handler); qInstallMsgHandler(lamexp_message_handler);
iResult = lamexp_main(argc, argv); iResult = lamexp_main(argc, argv);
lamexp_finalization(); lamexp_finalization();
return iResult;
} }
catch(char *error) catch(char *error)
{ {
@ -225,6 +225,7 @@ int main(int argc, char* argv[])
FatalAppExit(0, L"Unhandeled exception error, application will exit!"); FatalAppExit(0, L"Unhandeled exception error, application will exit!");
TerminateProcess(GetCurrentProcess(), -1); TerminateProcess(GetCurrentProcess(), -1);
} }
return iResult;
} }
} }

View File

@ -136,7 +136,7 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath)
process.setProcessChannelMode(QProcess::MergedChannels); process.setProcessChannelMode(QProcess::MergedChannels);
process.setReadChannel(QProcess::StandardOutput); process.setReadChannel(QProcess::StandardOutput);
process.start(m_mediaInfoBin, QStringList() << QDir::toNativeSeparators(filePath)); process.start(m_mediaInfoBin, QStringList() << QDir::toNativeSeparators(filePath));
if(!process.waitForStarted()) if(!process.waitForStarted())
{ {
qWarning("MediaInfo process failed to create!"); qWarning("MediaInfo process failed to create!");