aboutsummaryrefslogtreecommitdiff
path: root/src/common/Debugging
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-09-15 12:13:54 +0200
committerOvahlord <dreadkiller@gmx.de>2024-09-16 17:32:22 +0200
commitb0b87aeea1a324af3a8c16be4b87bed05929de4e (patch)
treed1c2064310a7427d521014527ceff16e2a44363d /src/common/Debugging
parentec85afdbc7b37f68df8ce74c42649e82ac35b4c1 (diff)
Core/CrashHandler: Compile WheatyExceptionReport only once and moved its global variable initializer to all projects using it
(cherry picked from commit fd0a7ba871060c895fdf701799dbf649ee697078)
Diffstat (limited to 'src/common/Debugging')
-rw-r--r--src/common/Debugging/Windows/WheatyExceptionReport.cpp (renamed from src/common/Debugging/WheatyExceptionReport.cpp)3
-rw-r--r--src/common/Debugging/Windows/WheatyExceptionReport.h (renamed from src/common/Debugging/WheatyExceptionReport.h)11
2 files changed, 9 insertions, 5 deletions
diff --git a/src/common/Debugging/WheatyExceptionReport.cpp b/src/common/Debugging/Windows/WheatyExceptionReport.cpp
index c9e3a985543..cec3a27e002 100644
--- a/src/common/Debugging/WheatyExceptionReport.cpp
+++ b/src/common/Debugging/Windows/WheatyExceptionReport.cpp
@@ -67,9 +67,6 @@ std::stack<SymbolDetail> WheatyExceptionReport::symbolDetails;
bool WheatyExceptionReport::alreadyCrashed;
std::mutex WheatyExceptionReport::alreadyCrashedLock;
WheatyExceptionReport::pRtlGetVersion WheatyExceptionReport::RtlGetVersion;
-
-// Declare global instance of class
-WheatyExceptionReport g_WheatyExceptionReport;
#pragma warning(pop)
//============================== Class Methods =============================
diff --git a/src/common/Debugging/WheatyExceptionReport.h b/src/common/Debugging/Windows/WheatyExceptionReport.h
index baca9699c5b..d154fce0d13 100644
--- a/src/common/Debugging/WheatyExceptionReport.h
+++ b/src/common/Debugging/Windows/WheatyExceptionReport.h
@@ -3,6 +3,7 @@
#define _NO_CVCONST_H
+#include "Define.h"
#include "Optional.h"
#include <windows.h>
#include <winnt.h>
@@ -322,7 +323,7 @@ struct SymbolDetail
bool HasChildren;
};
-class WheatyExceptionReport
+class TC_COMMON_API WheatyExceptionReport
{
public:
@@ -396,5 +397,11 @@ class WheatyExceptionReport
};
-extern WheatyExceptionReport g_WheatyExceptionReport; // global instance of class
+#define INIT_CRASH_HANDLER() \
+ __pragma(warning(push)) \
+ __pragma(warning(disable:4073)) /* C4073: initializers put in library initialization area */ \
+ __pragma(init_seg(lib)) \
+ WheatyExceptionReport g_WheatyExceptionReport; \
+ __pragma(warning(pop))
+
#endif // _WHEATYEXCEPTIONREPORT_