Skip to content
This repository was archived by the owner on Sep 1, 2021. It is now read-only.

Breakpad #48

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
42faf48
initial commit for Visual Studio support
etp12 Jan 18, 2016
8e7740f
added removeVLA patch
etp12 Jan 18, 2016
3de41e2
Merge pull request #1 from cryos/master
etp12 Jan 18, 2016
d4a6827
new patch
etp12 Jan 23, 2016
3ef4de9
removed patches to retry git diff
etp12 Jan 27, 2016
dc4f9b7
updated removeVLA2.diff patch
etp12 Jan 27, 2016
cbfb9a1
basic breakpad integration for Windows
etp12 Jan 28, 2016
f0b23ad
fixed integration syntax
etp12 Jan 28, 2016
969a2a6
removing git files from breakpad
etp12 Jan 28, 2016
1fd98ff
readding breakpad files
etp12 Jan 28, 2016
b2b32b4
Merge pull request #2 from cryos/master
etp12 Jan 31, 2016
ca4eff8
initial setup for dialog box for sending breakpad error reports
etp12 Jan 31, 2016
288c406
breakpad .dump file created on debug but not on release
etp12 Feb 1, 2016
af5817e
can be tested using spectra extension, dialog appears and asks user i…
etp12 Feb 2, 2016
3064bdc
removed breakpad .libs from this repo
etp12 Feb 2, 2016
9568900
Added error report sending options to settingsdialog, need to fix QSe…
etp12 Feb 13, 2016
7869e87
TODO: load settings into settings dialog
etp12 Feb 15, 2016
f3bf854
added VRML dialog
etp12 Feb 15, 2016
a142001
breakpad settings dialog working
etp12 Feb 18, 2016
87e486d
update to settings dialog
etp12 Feb 18, 2016
b875157
Merge pull request #3 from etp12/vrml
etp12 Feb 18, 2016
9a197b5
removed vrml changes from this branch
etp12 Feb 22, 2016
de0ca0e
dumps can now be sent to a server
etp12 Feb 25, 2016
27d89f2
cleanup before merge
etp12 Feb 25, 2016
b21d55c
fixed breakpad header files
etp12 Feb 25, 2016
2251623
revert mysm changes for this branch
etp12 Mar 4, 2016
c7b92e7
more reverts
etp12 Mar 4, 2016
46df7d3
removed git attribute file
etp12 Mar 4, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 75 additions & 1 deletion avogadro/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#include <avogadro/global.h>
#include <openbabel/babelconfig.h>

#ifdef ENABLE_GLSL
#include <GL/glew.h>
#endif
Expand All @@ -41,6 +40,9 @@
#include <QLibraryInfo>
#include <QProcess>
#include <QFont>
#include <QDir>
#include <QDialog>
#include <QCheckBox>

#include <iostream>

Expand All @@ -51,6 +53,12 @@
#include "mainwindow.h"
#include "application.h"

// Google breakpapd
#ifdef WIN32
#include "client/windows/handler/exception_handler.h"
#include "client/windows/sender/crash_report_sender.h"
#endif

#ifdef Q_WS_X11
#include <X11/Xlib.h>
#endif
Expand All @@ -68,8 +76,23 @@ using namespace Avogadro;
void printVersion(const QString &appName);
void printHelp(const QString &appName);

//for Breakpad error reporting
bool sendErrorDialog(void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion);
bool sendCrashServer(const wchar_t* dump_path, const wchar_t* minidump_id, void* context,
EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool succeeded);

struct arginfo {
int argc;
char **argv;
}*args;

int main(int argc, char *argv[])
{
//save main args in case of crash
args = new struct arginfo;
args->argc = argc;
args->argv = argv;

#ifdef Q_WS_X11
if(Library::threadedGL()) {
std::cout << "Enabling Threads" << std::endl;
Expand All @@ -85,6 +108,12 @@ int main(int argc, char *argv[])
QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
}
#endif
//set up Google Breakpad directory

if (!(QDir().mkdir("crash-reports")) && !(QDir("crash-reports").exists()))
qDebug() << "Could not create crash-reports directory.";
else
qDebug() << "/crash-reports successfully created.";

// set up groups for QSettings
QCoreApplication::setOrganizationName("SourceForge");
Expand Down Expand Up @@ -263,6 +292,15 @@ int main(int argc, char *argv[])
}
}
}

//initate Google Breakpad
google_breakpad::ExceptionHandler *pHandler = new google_breakpad::ExceptionHandler(
L"crash-reports",
sendErrorDialog,
sendCrashServer,
args,
google_breakpad::ExceptionHandler::HANDLER_ALL);

window->show();
return app.exec();
}
Expand Down Expand Up @@ -297,3 +335,39 @@ void printHelp(const QString &appName)
).arg(appName, VERSION).toStdWString();
#endif
}

bool sendCrashServer(const wchar_t* dump_path, const wchar_t* minidump_id, void* context,
EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool succeeded)
{
if (succeeded) {
google_breakpad::CrashReportSender sender(L"crash.checkpoint");
std::map<std::wstring, std::wstring> params;
std::wstring filename = dump_path;
filename += L"\\";
filename += minidump_id;
filename += L".dmp";

sender.set_max_reports_per_day(-1);

return(google_breakpad::RESULT_SUCCEEDED == sender.SendCrashReport(L"http://crash.avogadro.cc/crash_upload", params, filename, 0));
}
else
return false;
}

bool sendErrorDialog(void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion) {
QSettings settings;
if (settings.value("noAskErrorReport").toBool())
return settings.value("sendErrorReport").toBool();
else {
Application app(args->argc, args->argv);
delete(args);

QMessageBox msgBox(QMessageBox::Question, "Avogadro", "Avogadro has crashed! Would you like to send an error report?", 0, NULL);

QAbstractButton* yes = (QAbstractButton*)msgBox.addButton(QMessageBox::Yes);
QAbstractButton* no = (QAbstractButton*)msgBox.addButton(QMessageBox::No);

return (msgBox.exec() == QMessageBox::Yes);
}
}
20 changes: 19 additions & 1 deletion avogadro/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@

#include <Eigen/Geometry>
#include <Eigen/Array>

#define USEQUAT
// This is a "hidden" exported Qt function on the Mac for Qt-4.x.
#ifdef Q_WS_MAC
Expand Down Expand Up @@ -2576,6 +2577,18 @@ class XMLEventSource : public pqEventSource
return d->glWidget->quality();
}

bool MainWindow::getNoAskErrorReport() const
{
QSettings settings;
return settings.value("noAskErrorReport").toBool();
}

bool MainWindow::getSendErrorReport() const
{
QSettings settings;
return settings.value("sendErrorReport").toBool();
}

void MainWindow::setFogLevel(int level)
{
d->glWidget->setFogLevel(level);
Expand All @@ -2586,7 +2599,12 @@ class XMLEventSource : public pqEventSource
{
return d->glWidget->fogLevel();
}

void MainWindow::setErrorReport(bool value, bool send)
{
QSettings settings;
settings.setValue("noAskErrorReport", value);
settings.setValue("sendErrorReport", send);
}
void MainWindow::newView()
{
QWidget *widget = new QWidget();
Expand Down
4 changes: 3 additions & 1 deletion avogadro/src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ namespace Avogadro {
MainWindow();
MainWindow(const QString &fileName);
~MainWindow();

int painterQuality() const;
bool getNoAskErrorReport() const;
bool getSendErrorReport() const;
int fogLevel() const;
bool renderAxes() const;
bool renderDebug() const;
Expand Down Expand Up @@ -159,6 +160,7 @@ namespace Avogadro {
void setBackgroundColor();
void setPainterQuality(int quality);
void setFogLevel(int level);
void setErrorReport(bool value, bool send);

/**
* Slot to switch glWidget to the perspective projection mode
Expand Down
21 changes: 20 additions & 1 deletion avogadro/src/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,18 @@ namespace Avogadro {
SLOT(qualityChanged(int)));
connect(ui.fogSlider, SIGNAL(valueChanged(int)), this,
SLOT(fogChanged(int)));
connect(ui.checkBox, SIGNAL(clicked(bool)), this,
SLOT(checkChanged(bool)));
}

void SettingsDialog::insertWidget(int index, QWidget *widget)
{
ui.stackedWidget->insertWidget(index, widget);
}

void SettingsDialog::checkChanged(bool value) {
ui.radioButton->setEnabled(value);
ui.radioButton_2->setEnabled(value);
}
void SettingsDialog::buttonClicked(QAbstractButton *button)
{
QDialogButtonBox::ButtonRole role = ui.dialogButtonBox->buttonRole(button);
Expand Down Expand Up @@ -87,13 +92,27 @@ namespace Avogadro {
{
m_mainWindow->setPainterQuality(ui.qualitySlider->value());
m_mainWindow->setFogLevel(ui.fogSlider->value());
if (ui.radioButton->isChecked()) {
m_mainWindow->setErrorReport(ui.checkBox->isChecked(), true);
}
else {
m_mainWindow->setErrorReport(ui.checkBox->isChecked(), false);
}
}

void SettingsDialog::loadValues()
{
ui.qualitySlider->setValue(m_mainWindow->painterQuality());
fogChanged(m_mainWindow->fogLevel());
qualityChanged(m_mainWindow->painterQuality());
ui.checkBox->setChecked(m_mainWindow->getNoAskErrorReport());
if (ui.checkBox->isChecked()) {
bool send = m_mainWindow->getSendErrorReport();
if (send)
ui.radioButton->setChecked(true);
else
ui.radioButton->setChecked(false);
}
}

void SettingsDialog::qualityChanged(int value)
Expand Down
1 change: 1 addition & 0 deletions avogadro/src/settingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ namespace Avogadro {
MainWindow *m_mainWindow;

private Q_SLOTS:
void checkChanged(bool value);
void buttonClicked(QAbstractButton *button);
void saveValues();
void loadValues();
Expand Down
32 changes: 31 additions & 1 deletion avogadro/src/settingsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
</item>
</layout>
</item>
<item row="2" column="0">
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand All @@ -163,6 +163,36 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Do not ask about Error Reporting</string>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QRadioButton" name="radioButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Yes, always send reports</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QRadioButton" name="radioButton_2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>No, never send reports</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
69 changes: 0 additions & 69 deletions crystals/zeolites/CON.cif

This file was deleted.

1 change: 0 additions & 1 deletion libavogadro/src/extensions/spectra/spectraextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,3 @@ namespace Avogadro {
} // end namespace Avogadro

Q_EXPORT_PLUGIN2(spectraextension, Avogadro::SpectraExtensionFactory)

4 changes: 3 additions & 1 deletion libavogadro/src/extensions/surfaces/openqube/gaussianset.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

#ifndef GAUSSIANSET_H
#define GAUSSIANSET_H

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "config.h"

#include "basisset.h"
Expand Down
Loading