Skip to content

Commit

Permalink
mac_fix: fix crash reporter on mac
Browse files Browse the repository at this point in the history
- stop compiling breakpad on mac

- stop using ElmavCrashHandler on mac
  to install signal handlers

- use old signal handlers to catch crashes

- send a simple 'Crash!' message when ever El-Maven
  crashes
  • Loading branch information
rish9511 authored and sahil21 committed May 17, 2018
1 parent bec3a5c commit 5587a5e
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
4 changes: 3 additions & 1 deletion 3rdparty/3rdparty.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ CONFIG += ordered qt thread
SUBDIRS += obiwarp libneural libcdfread libcsvparser pugixml/src libpillow libpls Logger ErrorHandling google-breakpad

macx {
SUBDIRS -= libcdfread

SUBDIRS -= libcdfread google-breakpad

}
7 changes: 6 additions & 1 deletion src/gui/mzroll/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
#include "mzfileio.h"
#include "controller.h"
#include "elmavenlogger.h"

#ifndef Q_OS_MAC
#include "ElmavCrashHandler.h"
#endif

#include <QDir>
#include <list>
Expand Down Expand Up @@ -56,9 +59,11 @@ int main(int argc, char *argv[])
qApp->setApplicationName("El-Maven");

initializeLogger();

#ifndef Q_OS_MAC
ElmavCrashHandler elMavCh;
Q_UNUSED(elMavCh);

#endif


QPixmap pixmap(":/images/splash.png","PNG",Qt::ColorOnly);
Expand Down
32 changes: 31 additions & 1 deletion src/gui/mzroll/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@ QDataStream &operator>>(QDataStream &in, SpectralHit*) {
}


#ifdef Q_OS_MAC
long long mainwindowDummy;
void signalHandler( int signum ) {
std::cerr << "crash, signum = " << signum;
QString crashReporterPath;
QString binFolder = qApp->applicationDirPath() + QDir::separator() + ".." + QDir::separator() + ".." \
+ QDir::separator() + ".." + QDir::separator();
crashReporterPath = binFolder + "CrashReporter.app" + QDir::separator() + "Contents" + QDir::separator() + "MacOS" + QDir::separator() + "CrashReporter";

QProcess *pr = new QProcess;
pr->setProgram(crashReporterPath);
pr->setProcessChannelMode(QProcess::SeparateChannels);
pr->startDetached(crashReporterPath);
exit(signum);
}
#endif

void MainWindow::setValue(int value)
{
if (value != m_value) {
Expand Down Expand Up @@ -126,7 +143,20 @@ using namespace mzUtils;
connect( this, SIGNAL (reBoot()), this, SLOT (slotReboot()));
m_value=0;

qRegisterMetaType<mzSample*>("mzSample*");
#ifdef Q_OS_MAC
mainwindowDummy = (long long) this;
//signal(SIGINT, signalHandler);
signal(SIGFPE, signalHandler);
signal(SIGILL, signalHandler);
signal(SIGABRT, signalHandler);
signal(SIGSEGV, signalHandler);
signal(SIGTERM, signalHandler);
signal(SIGQUIT, signalHandler);
signal(SIGBUS, signalHandler);
signal(SIGSYS, signalHandler);
#endif

qRegisterMetaType<mzSample*>("mzSample*");
qRegisterMetaTypeStreamOperators<mzSample*>("mzSample*");

qRegisterMetaType<Compound*>("Compound*");
Expand Down
5 changes: 5 additions & 0 deletions src/gui/mzroll/mzroll.pro
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ database.cpp \
numeric_treewidgetitem.cpp \
ElmavCrashHandler.cpp

macx{
SOURCES -= ElmavCrashHandler.cpp
HEADERS -= ElmavCrashHandler.h
}

contains (DEFINES,EMBEDHTTPSERVER) {
SOURCES += remotespectrahandler.cpp
HEADERS += remotespectrahandler.h
Expand Down

0 comments on commit 5587a5e

Please sign in to comment.