mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 22:56:42 +02:00
Log uncaught exceptions and crash on windows
This commit is contained in:
@@ -43,6 +43,7 @@
|
|||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -177,6 +178,13 @@ main( int argc, char *argv[] )
|
|||||||
QObject::connect( &guard, SIGNAL( instanceStarted( KDSingleApplicationGuard::Instance ) ), &a, SLOT( instanceStarted( KDSingleApplicationGuard::Instance ) ) );
|
QObject::connect( &guard, SIGNAL( instanceStarted( KDSingleApplicationGuard::Instance ) ), &a, SLOT( instanceStarted( KDSingleApplicationGuard::Instance ) ) );
|
||||||
|
|
||||||
int returnCode = 0;
|
int returnCode = 0;
|
||||||
|
|
||||||
|
// catch unhandled exceptions to log them
|
||||||
|
// setupLogfile must be called from TomahawkApp.init to have the logging working
|
||||||
|
// unfortunately MinGW does not catch std::exceptions as system exceptions
|
||||||
|
// so we need to crash to make the crashreporter come up
|
||||||
|
try
|
||||||
|
{
|
||||||
if ( guard.isPrimaryInstance() )
|
if ( guard.isPrimaryInstance() )
|
||||||
{
|
{
|
||||||
a.init();
|
a.init();
|
||||||
@@ -184,6 +192,25 @@ main( int argc, char *argv[] )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
qDebug() << "Tomahawk is already running, shutting down.";
|
qDebug() << "Tomahawk is already running, shutting down.";
|
||||||
|
}
|
||||||
|
catch( std::exception& exception )
|
||||||
|
{
|
||||||
|
tLog() << "Uncaught exception: what(): " << exception.what();
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
TomahawkUtils::crash();
|
||||||
|
#else
|
||||||
|
throw;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
catch ( ... )
|
||||||
|
{
|
||||||
|
tLog() << "Uncaught non std::exception";
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
TomahawkUtils::crash();
|
||||||
|
#else
|
||||||
|
throw;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
// clean up keyboard hook
|
// clean up keyboard hook
|
||||||
|
Reference in New Issue
Block a user