[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r3852: Check both the minidump file and the .dmp.info file for exis (vidalia/branches/breakpad/src/crashreporter)
Author: edmanm
Date: 2009-06-15 01:21:07 -0400 (Mon, 15 Jun 2009)
New Revision: 3852
Modified:
vidalia/branches/breakpad/src/crashreporter/main.cpp
Log:
Check both the minidump file and the .dmp.info file for existence and
readability when the crash reporter starts, and display a message if
either of those is not met. This is unlikely to happen, unless we're
so badly crashed we can't even write a minidump (out of disk space
maybe?).
Modified: vidalia/branches/breakpad/src/crashreporter/main.cpp
===================================================================
--- vidalia/branches/breakpad/src/crashreporter/main.cpp 2009-06-14 23:13:09 UTC (rev 3851)
+++ vidalia/branches/breakpad/src/crashreporter/main.cpp 2009-06-15 05:21:07 UTC (rev 3852)
@@ -18,15 +18,79 @@
#include "CrashReportDialog.h"
#include <QApplication>
+#include <QFileInfo>
+#include <QMessageBox>
int
main(int argc, char *argv[])
{
QApplication app(argc, argv);
+ QFileInfo minidumpFile, extraInfoFile;
+ QString errorMessage;
- CrashReportDialog dlg;
- dlg.show();
+ if (argc < 2) {
+ errorMessage = "No minidump file specified.";
+ goto err;
+ }
+ /* Ensure that the specified minidump file exists and is readable */
+ minidumpFile = QFileInfo(argv[1]);
+ if (! minidumpFile.exists() || ! minidumpFile.size()) {
+ errorMessage = QString("The specified minidump file does not exist: %1")
+ .arg(minidumpFile.absoluteFilePath());
+ goto err;
+ }
+ if (! minidumpFile.isReadable()) {
+ errorMessage = QString("The specified minidump file is not readable: %1")
+ .arg(minidumpFile.absoluteFilePath());
+ goto err;
+ }
+
+ /* Ensure that the specified minidump has an associated extra crash
+ * information file that exists and is readable. */
+ extraInfoFile = QFileInfo(minidumpFile.absoluteFilePath() + ".info");
+ if (! extraInfoFile.exists() || ! extraInfoFile.size()) {
+ errorMessage = QString("The specified minidump does not have a "
+ "corresponding crash information file: %1");
+ goto err;
+ }
+ if (! extraInfoFile.isReadable()) {
+ errorMessage = QString("The specified crash information file is not "
+ "readable: %1").arg(extraInfoFile.absoluteFilePath());
+ goto err;
+ }
+
+ /* Display the crash reporting dialog */
+ {
+ CrashReportDialog dlg;
+ dlg.show();
+ }
+
return app.exec();
+
+err:
+ /* We encountered an error trying to load the minidump or extra crash
+ * information file. So, display an error and then bail, since now there's
+ * nothing for us to send. */
+ QMessageBox dlg;
+ dlg.setWindowIcon(QIcon(":/images/32x32/tools-report-bug.png"));
+ dlg.setWindowTitle("Crash Reporter Error");
+
+ dlg.setIconPixmap(QPixmap(":/images/64x64/tools-report-bug.png"));
+ dlg.setStandardButtons(QMessageBox::Ok);
+
+ dlg.setText("<b>Vidalia encountered an error and needed to close</b>");
+ dlg.setInformativeText(
+ "<p>Vidalia attempted to automatically create an error report to "
+ "help diagnose the problem, but was unable to do so. Please report "
+ "this problem, along with what you were doing before Vidalia crashed, "
+ "to the developers at:</p><p>"
+ "<a href=\"https://trac.vidalia-project.net/wiki/ReportingBugs\">"
+ "https://trac.vidalia-project.net/wiki/ReportingBugs</a></p> "
+ "<p>Click \"Show Details\" below for information about the problem "
+ "encountered.");
+
+ dlg.setDetailedText(errorMessage);
+ return dlg.exec();
}