From 3e3dd7b5b5b96d7d4ffc83357a7b44af0b1f5def Mon Sep 17 00:00:00 2001 From: taynpg Date: Sun, 29 Jun 2025 17:05:31 +0800 Subject: [PATCH] fix: unix system build. --- Server/main.cpp | 1 + Struct/{infoMsg.cpp => InfoMsg.cpp} | 0 crashelper/include/backward.hpp | 4 ++-- crashelper/src/crashelper.cxx | 10 ++++++++-- 4 files changed, 11 insertions(+), 4 deletions(-) rename Struct/{infoMsg.cpp => InfoMsg.cpp} (100%) diff --git a/Server/main.cpp b/Server/main.cpp index efaace0..e1fba3d 100644 --- a/Server/main.cpp +++ b/Server/main.cpp @@ -1,4 +1,5 @@ #include +#include #include #include "Server.h" diff --git a/Struct/infoMsg.cpp b/Struct/InfoMsg.cpp similarity index 100% rename from Struct/infoMsg.cpp rename to Struct/InfoMsg.cpp diff --git a/crashelper/include/backward.hpp b/crashelper/include/backward.hpp index 6aa4cdd..1d7a1f9 100644 --- a/crashelper/include/backward.hpp +++ b/crashelper/include/backward.hpp @@ -4271,8 +4271,8 @@ private: class SignalHandling { private: - static inline std::function crash_path_getter_ = nullptr; - static inline std::function user_sig_handler_ = nullptr; + static std::function crash_path_getter_; + static std::function user_sig_handler_; public: static void register_crash_path(std::function&& crash_path_getter) diff --git a/crashelper/src/crashelper.cxx b/crashelper/src/crashelper.cxx index cb3f04b..e68e60a 100644 --- a/crashelper/src/crashelper.cxx +++ b/crashelper/src/crashelper.cxx @@ -10,9 +10,14 @@ #include "backward.hpp" +#ifdef _WIN32 std::function backward::SignalHandling::crash_path_getter_ = nullptr; std::function backward::SignalHandling::crash_use_handler_ = nullptr; std::function backward::SignalHandling::user_sig_handler_ = nullptr; +#else +std::function crash_path_getter_ = nullptr; +std::function 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)) { @@ -152,4 +158,4 @@ void UseExceptionHandler(EXCEPTION_POINTERS* exception) CloseHandle(hFile); } #endif -} // namespace backward \ No newline at end of file +} // namespace backward