fix: unix system build.

This commit is contained in:
2025-06-29 17:05:31 +08:00
parent 8185df66b4
commit 3e3dd7b5b5
4 changed files with 11 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
#include <QCoreApplication>
#include <QDir>
#include <Util.h>
#include "Server.h"

View File

@@ -4271,8 +4271,8 @@ private:
class SignalHandling
{
private:
static inline std::function<std::string()> crash_path_getter_ = nullptr;
static inline std::function<void(int sig)> user_sig_handler_ = nullptr;
static std::function<std::string()> crash_path_getter_;
static std::function<void(int sig)> user_sig_handler_;
public:
static void register_crash_path(std::function<std::string()>&& crash_path_getter)

View File

@@ -10,9 +10,14 @@
#include "backward.hpp"
#ifdef _WIN32
std::function<std::string()> backward::SignalHandling::crash_path_getter_ = nullptr;
std::function<void(EXCEPTION_POINTERS* info)> backward::SignalHandling::crash_use_handler_ = nullptr;
std::function<void(int sig)> backward::SignalHandling::user_sig_handler_ = nullptr;
#else
std::function<std::string()> crash_path_getter_ = nullptr;
std::function<void(int sig)> user_sig_handler_ = nullptr;
#endif
namespace backward {
@@ -132,7 +137,8 @@ void UseExceptionHandler(EXCEPTION_POINTERS* exception)
QString fullPath = QDir(h.dumpSavePath_).absoluteFilePath(dumpName);
QString fullFailedPath = QDir(h.dumpSavePath_).absoluteFilePath(dumpFailedLog);
HANDLE hFile = CreateFileA(fullPath.toStdString().c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
HANDLE hFile =
CreateFileA(fullPath.toStdString().c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
QFile file(fullFailedPath);
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {