repo/testing/falkon/patches/0001-falkon-no-execinfo.patch

116 lines
3.6 KiB
Diff
Raw Normal View History

2020-01-17 14:33:45 -07:00
From 66d6e81e2336f60d2513159cbff5f3d33b74d83d Mon Sep 17 00:00:00 2001
From: David Rosca <nowrep@gmail.com>
Date: Mon, 22 Apr 2019 09:46:39 +0200
Subject: [PATCH] main: Remove backtrace handler
---
src/main/main.cpp | 81 -----------------------------------------------
1 file changed, 81 deletions(-)
diff --git a/src/main/main.cpp b/src/main/main.cpp
index c1af1b6f..3315ef25 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -17,84 +17,9 @@
* ============================================================ */
#include "mainapplication.h"
#include "proxystyle.h"
-#include "datapaths.h"
-#include <QMessageBox> // For QT_REQUIRE_VERSION
#include <iostream>
-#if defined(Q_OS_LINUX) || defined(__GLIBC__) || defined(__FreeBSD__) || defined(__HAIKU__)
-#include <signal.h>
-#include <execinfo.h>
-
-#include <QDir>
-#include <QDateTime>
-#include <QTextStream>
-#include <QWebEnginePage>
-
-void falkon_signal_handler(int s)
-{
- if (s != SIGSEGV) {
- return;
- }
-
- static bool sigSegvServed = false;
- if (sigSegvServed) {
- abort();
- }
- sigSegvServed = true;
-
- std::cout << "Falkon: Crashed :( Saving backtrace in " << qPrintable(DataPaths::path(DataPaths::Config)) << "/crashlog ..." << std::endl;
-
- void* array[100];
- int size = backtrace(array, 100);
- char** strings = backtrace_symbols(array, size);
-
- if (size < 0 || !strings) {
- std::cout << "Cannot get backtrace!" << std::endl;
- abort();
- }
-
- QDir dir(DataPaths::path(DataPaths::Config));
- if (!dir.exists()) {
- std::cout << qPrintable(DataPaths::path(DataPaths::Config)) << " does not exist" << std::endl;
- abort();
- }
-
- if (!dir.cd("crashlog")) {
- if (!dir.mkdir("crashlog")) {
- std::cout << "Cannot create " << qPrintable(DataPaths::path(DataPaths::Config)) << "crashlog directory!" << std::endl;
- abort();
- }
-
- dir.cd("crashlog");
- }
-
- const QDateTime currentDateTime = QDateTime::currentDateTime();
-
- QFile file(dir.absoluteFilePath("Crash-" + currentDateTime.toString(Qt::ISODate) + ".txt"));
- if (!file.open(QFile::WriteOnly | QFile::Truncate)) {
- std::cout << "Cannot open file " << qPrintable(file.fileName()) << " for writing!" << std::endl;
- abort();
- }
-
- QTextStream stream(&file);
- stream << "Time: " << currentDateTime.toString() << endl;
- stream << "Qt version: " << qVersion() << " (compiled with " << QT_VERSION_STR << ")" << endl;
- stream << "Falkon version: " << Qz::VERSION << endl;
- stream << "Rendering engine: QtWebEngine" << endl;
- stream << endl;
- stream << "============== BACKTRACE ==============" << endl;
-
- for (int i = 0; i < size; ++i) {
- stream << "#" << i << ": " << strings[i] << endl;
- }
-
- file.close();
-
- std::cout << "Backtrace successfully saved in " << qPrintable(dir.absoluteFilePath(file.fileName())) << std::endl;
-}
-#endif // defined(Q_OS_LINUX) || defined(__GLIBC__) || defined(__FreeBSD__)
-
#ifndef Q_OS_WIN
void msgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
@@ -123,16 +48,10 @@ void msgHandler(QtMsgType type, const QMessageLogContext &context, const QString
int main(int argc, char* argv[])
{
- QT_REQUIRE_VERSION(argc, argv, "5.8.0");
-
#ifndef Q_OS_WIN
qInstallMessageHandler(&msgHandler);
#endif
-#if defined(Q_OS_LINUX) || defined(__GLIBC__) || defined(__FreeBSD__)
- signal(SIGSEGV, falkon_signal_handler);
-#endif
-
// Hack to fix QT_STYLE_OVERRIDE with QProxyStyle
const QByteArray style = qgetenv("QT_STYLE_OVERRIDE");
if (!style.isEmpty()) {