diff --git a/src/breakpad/BreakPad.cpp b/src/breakpad/BreakPad.cpp index d86e26d18..d6721da75 100644 --- a/src/breakpad/BreakPad.cpp +++ b/src/breakpad/BreakPad.cpp @@ -18,7 +18,9 @@ #include "BreakPad.h" +#include #include +#include #ifndef WIN32 #include @@ -35,6 +37,7 @@ LaunchUploader( const char* dump_dir, const char* minidump_id, void* that, bool if ( !succeeded ) return false; + const char* crashReporter = static_cast(that)->crashReporter(); pid_t pid = fork(); if ( pid == -1 ) // fork failed @@ -42,8 +45,8 @@ LaunchUploader( const char* dump_dir, const char* minidump_id, void* that, bool if ( pid == 0 ) { // we are the fork - execl( CRASH_REPORTER_BINARY, - CRASH_REPORTER_BINARY, + execl( crashReporter, + crashReporter, dump_dir, minidump_id, minidump_id, @@ -67,6 +70,14 @@ BreakPad::BreakPad( const QString& path ) : google_breakpad::ExceptionHandler( path.toStdString(), 0, LaunchUploader, this, true, 0 ) #endif { + QString reporter = QString( "%1/%2" ).arg( qApp->applicationDirPath() ).arg( CRASH_REPORTER_BINARY ); + + char* creporter; + std::string sreporter = reporter.toStdString(); + creporter = new char[ sreporter.size() + 1 ]; + strcpy( creporter, sreporter.c_str() ); + + m_crashReporter = creporter; } @@ -82,12 +93,12 @@ LaunchUploader( const wchar_t* dump_dir, const wchar_t* minidump_id, void* that, // DON'T USE THE HEAP!!! // So that indeed means, no QStrings, no qDebug(), no QAnything, seriously! - const char* m_product_name = static_cast(that)->productName(); + const char* productName = static_cast(that)->productName(); - // convert m_product_name to widechars, which sadly means the product name must be Latin1 - wchar_t product_name[ 256 ]; + // convert productName to widechars, which sadly means the product name must be Latin1 + wchar_t productName[ 256 ]; char* out = (char*)product_name; - const char* in = m_product_name - 1; + const char* in = productName - 1; do { *out++ = *++in; //latin1 chars fit in first byte of each wchar *out++ = '\0'; //every second byte is NULL diff --git a/src/breakpad/BreakPad.h b/src/breakpad/BreakPad.h index 61a5da157..9de4d5a63 100644 --- a/src/breakpad/BreakPad.h +++ b/src/breakpad/BreakPad.h @@ -28,7 +28,8 @@ class BreakPad : public google_breakpad::ExceptionHandler { - const char* m_product_name; // yes! It MUST be const char[] + const char* m_productName; // yes! It MUST be const char[] + const char* m_crashReporter; // again, const char[] public: BreakPad( const QString &dump_write_dirpath ); @@ -36,8 +37,11 @@ public: ~BreakPad() {} - void setProductName( const char* s ) { m_product_name = s; }; - const char* productName() const { return m_product_name; } + void setProductName( const char* s ) { m_productName = s; }; + const char* productName() const { return m_productName; } + + void setCrashReporter( const char* s ) { m_crashReporter = s; }; + const char* crashReporter() const { return m_crashReporter; } }; #undef char diff --git a/src/libtomahawk/tomahawksettings.cpp b/src/libtomahawk/tomahawksettings.cpp index 86a026522..1aa88bcbb 100644 --- a/src/libtomahawk/tomahawksettings.cpp +++ b/src/libtomahawk/tomahawksettings.cpp @@ -36,6 +36,7 @@ using namespace Tomahawk; TomahawkSettings* TomahawkSettings::s_instance = 0; + inline QDataStream& operator<<(QDataStream& out, const AtticaManager::StateHash& states) { out << (quint32)states.count(); @@ -47,6 +48,7 @@ inline QDataStream& operator<<(QDataStream& out, const AtticaManager::StateHash& return out; } + inline QDataStream& operator>>(QDataStream& in, AtticaManager::StateHash& states) { quint32 count = 0; @@ -64,6 +66,7 @@ inline QDataStream& operator>>(QDataStream& in, AtticaManager::StateHash& states return in; } + TomahawkSettings* TomahawkSettings::instance() { diff --git a/src/main.cpp b/src/main.cpp index fdb4f33c8..6f51aeed8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,10 +35,6 @@ int main( int argc, char *argv[] ) { -#ifndef Q_WS_WIN - new BreakPad( "/tmp" ); -#endif - #ifdef Q_WS_MAC // Do Mac specific startup to get media keys working. // This must go before QApplication initialisation. @@ -50,6 +46,11 @@ main( int argc, char *argv[] ) #endif TomahawkApp a( argc, argv ); + +#ifndef Q_WS_WIN + new BreakPad( "/tmp" ); +#endif + KDSingleApplicationGuard guard( &a, KDSingleApplicationGuard::AutoKillOtherInstances ); QObject::connect( &guard, SIGNAL( instanceStarted( KDSingleApplicationGuard::Instance ) ), &a, SLOT( instanceStarted( KDSingleApplicationGuard::Instance ) ) );