mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 07:49:42 +01:00
* Make sure to always launch CrashReporter from the directory the Tomahawk executable lives in.
This commit is contained in:
parent
61e934bacc
commit
cf054875b5
@ -18,7 +18,9 @@
|
||||
|
||||
#include "BreakPad.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QString>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
@ -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<BreakPad*>(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<BreakPad*>(that)->productName();
|
||||
const char* productName = static_cast<BreakPad*>(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
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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 ) ) );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user