mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-21 09:08:41 +02:00
Linux: stack trace on crash
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "WindowManager.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QInputDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
@@ -38,6 +39,8 @@ WindowManager::WindowManager(EventFilter *eventFilter)
|
||||
|
||||
this->initSkins();
|
||||
|
||||
this->showCrashLogs();
|
||||
|
||||
if (!config()->get(Config::firstRun).toBool() || TailsOS::detect() || WhonixOS::detect()) {
|
||||
this->onInitialNetworkConfigured();
|
||||
}
|
||||
@@ -410,6 +413,58 @@ void WindowManager::displayWalletErrorMessage(const QString &message) {
|
||||
}
|
||||
}
|
||||
|
||||
void WindowManager::showCrashLogs() {
|
||||
QString crashLogPath{Config::defaultConfigDir().path() + "/crash_report.txt"};
|
||||
QFile crashLogFile{crashLogPath};
|
||||
|
||||
if (!crashLogFile.exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool r = crashLogFile.open(QIODevice::ReadOnly);
|
||||
if (!r) {
|
||||
qWarning() << "Unable to open crash log file: " << crashLogPath;
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream log(&crashLogFile);
|
||||
QString logString = log.readAll();
|
||||
crashLogFile.close();
|
||||
|
||||
bool renamed = false;
|
||||
for (int i = 1; i < 999; i++) {
|
||||
QString name{QString("/crash_report_%1.txt").arg(QString::number(i))};
|
||||
if (crashLogFile.rename(Config::defaultConfigDir().path() + name)) {
|
||||
renamed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!renamed) {
|
||||
crashLogFile.remove();
|
||||
}
|
||||
|
||||
QDialog dialog(nullptr);
|
||||
dialog.setWindowTitle("Crash report");
|
||||
|
||||
QVBoxLayout layout;
|
||||
QLabel msg{"Feather encountered an unrecoverable error.\n\nPlease send a copy of these logs to the developers. Logs are not automatically reported.\n"};
|
||||
QTextEdit logs;
|
||||
logs.setText(logString);
|
||||
|
||||
layout.addWidget(&msg);
|
||||
layout.addWidget(&logs);
|
||||
QDialogButtonBox buttons(QDialogButtonBox::Ok);
|
||||
layout.addWidget(&buttons);
|
||||
dialog.setLayout(&layout);
|
||||
QObject::connect(&buttons, &QDialogButtonBox::accepted, [&dialog]{
|
||||
dialog.close();
|
||||
});
|
||||
dialog.exec();
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// ######################## DEVICE ########################
|
||||
|
||||
void WindowManager::onDeviceButtonRequest(quint64 code) {
|
||||
|
||||
Reference in New Issue
Block a user