Skip to content

Commit 1eaaec4

Browse files
committed
Don't use noexcept in crash handler
1 parent 632283a commit 1eaaec4

File tree

5 files changed

+185
-185
lines changed

5 files changed

+185
-185
lines changed

Client/core/CCrashDumpWriter.cpp

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ static constexpr int SCREEN_MARGIN_PIXELS = 50;
5151
static constexpr int EMERGENCY_MSGBOX_WIDTH = 600;
5252
static constexpr int EMERGENCY_MSGBOX_HEIGHT = 200;
5353

54-
constexpr DWORD Milliseconds(std::chrono::milliseconds duration) noexcept
54+
constexpr DWORD Milliseconds(std::chrono::milliseconds duration)
5555
{
5656
return static_cast<DWORD>(duration.count());
5757
}
5858

59-
[[nodiscard]] static DWORD ResolveCrashExitCode(const _EXCEPTION_POINTERS* exceptionPtrs) noexcept
59+
[[nodiscard]] static DWORD ResolveCrashExitCode(const _EXCEPTION_POINTERS* exceptionPtrs)
6060
{
6161
if (const auto* record = (exceptionPtrs != nullptr) ? exceptionPtrs->ExceptionRecord : nullptr;
6262
record != nullptr && record->ExceptionCode != 0)
@@ -67,7 +67,7 @@ constexpr DWORD Milliseconds(std::chrono::milliseconds duration) noexcept
6767
return CRASH_EXIT_CODE;
6868
}
6969

70-
[[noreturn]] static void TerminateCurrentProcessWithExitCode(DWORD exitCode) noexcept
70+
[[noreturn]] static void TerminateCurrentProcessWithExitCode(DWORD exitCode)
7171
{
7272
if (exitCode == 0)
7373
{
@@ -82,7 +82,7 @@ constexpr DWORD Milliseconds(std::chrono::milliseconds duration) noexcept
8282

8383
class CClientBase;
8484

85-
static bool SafeReadGameByte(uintptr_t address, unsigned char& outValue) noexcept
85+
static bool SafeReadGameByte(uintptr_t address, unsigned char& outValue)
8686
{
8787
__try
8888
{
@@ -95,7 +95,7 @@ static bool SafeReadGameByte(uintptr_t address, unsigned char& outValue) noexcep
9595
}
9696
}
9797

98-
static bool InvokeClientHandleExceptionSafe(CClientBase* pClient, CExceptionInformation_Impl* pExceptionInformation, bool& outHandled) noexcept
98+
static bool InvokeClientHandleExceptionSafe(CClientBase* pClient, CExceptionInformation_Impl* pExceptionInformation, bool& outHandled)
9999
{
100100
outHandled = false;
101101

@@ -116,7 +116,7 @@ static bool InvokeClientHandleExceptionSafe(CClientBase* pClient, CExceptionInfo
116116

117117
namespace
118118
{
119-
void ConfigureDbgHelpOptions() noexcept
119+
void ConfigureDbgHelpOptions()
120120
{
121121
static std::atomic_flag configured = ATOMIC_FLAG_INIT;
122122
if (!configured.test_and_set(std::memory_order_acq_rel))
@@ -125,7 +125,7 @@ namespace
125125
}
126126
}
127127

128-
std::mutex& GetSymInitMutex() noexcept
128+
std::mutex& GetSymInitMutex()
129129
{
130130
static std::mutex symMutex;
131131
return symMutex;
@@ -135,7 +135,7 @@ namespace
135135
class SymbolHandlerGuard
136136
{
137137
public:
138-
explicit SymbolHandlerGuard(HANDLE process, bool enableSymbols) noexcept : m_process(process), m_initialized(false)
138+
explicit SymbolHandlerGuard(HANDLE process, bool enableSymbols) : m_process(process), m_initialized(false)
139139
{
140140
if (!enableSymbols)
141141
return;
@@ -154,7 +154,7 @@ class SymbolHandlerGuard
154154
}
155155
}
156156

157-
~SymbolHandlerGuard() noexcept
157+
~SymbolHandlerGuard()
158158
{
159159
if (m_initialized)
160160
SymCleanup(m_process);
@@ -165,7 +165,7 @@ class SymbolHandlerGuard
165165
SymbolHandlerGuard(SymbolHandlerGuard&&) = delete;
166166
SymbolHandlerGuard& operator=(SymbolHandlerGuard&&) = delete;
167167

168-
bool IsInitialized() const noexcept { return m_initialized; }
168+
bool IsInitialized() const { return m_initialized; }
169169

170170
private:
171171
HANDLE m_process;
@@ -280,23 +280,23 @@ static HANDLE ms_hCrashDialogProces
280280
return candidates;
281281
}
282282

283-
[[nodiscard]] static inline constexpr bool IsValidHandle(HANDLE handle) noexcept
283+
[[nodiscard]] static inline constexpr bool IsValidHandle(HANDLE handle)
284284
{
285285
return handle != nullptr && handle != INVALID_HANDLE_VALUE;
286286
}
287287

288288
class UniqueHandle
289289
{
290290
public:
291-
UniqueHandle() noexcept = default;
292-
explicit UniqueHandle(HANDLE handle) noexcept : m_handle(handle) {}
293-
~UniqueHandle() noexcept { reset(); }
291+
UniqueHandle() = default;
292+
explicit UniqueHandle(HANDLE handle) : m_handle(handle) {}
293+
~UniqueHandle() { reset(); }
294294

295295
UniqueHandle(const UniqueHandle&) = delete;
296296
UniqueHandle& operator=(const UniqueHandle&) = delete;
297297

298-
UniqueHandle(UniqueHandle&& other) noexcept : m_handle(other.release()) {}
299-
UniqueHandle& operator=(UniqueHandle&& other) noexcept
298+
UniqueHandle(UniqueHandle&& other) : m_handle(other.release()) {}
299+
UniqueHandle& operator=(UniqueHandle&& other)
300300
{
301301
if (this != &other)
302302
{
@@ -306,29 +306,29 @@ class UniqueHandle
306306
return *this;
307307
}
308308

309-
void reset(HANDLE handle = nullptr) noexcept
309+
void reset(HANDLE handle = nullptr)
310310
{
311311
if (IsValidHandle(m_handle))
312312
CloseHandle(m_handle);
313313
m_handle = handle;
314314
}
315315

316-
[[nodiscard]] HANDLE get() const noexcept { return m_handle; }
316+
[[nodiscard]] HANDLE get() const { return m_handle; }
317317

318-
[[nodiscard]] HANDLE release() noexcept
318+
[[nodiscard]] HANDLE release()
319319
{
320320
HANDLE handle = m_handle;
321321
m_handle = nullptr;
322322
return handle;
323323
}
324324

325-
[[nodiscard]] explicit operator bool() const noexcept { return IsValidHandle(m_handle); }
325+
[[nodiscard]] explicit operator bool() const { return IsValidHandle(m_handle); }
326326

327327
private:
328328
HANDLE m_handle = nullptr;
329329
};
330330

331-
static void EnsureCrashReasonForDialog(CExceptionInformation* pExceptionInformation) noexcept
331+
static void EnsureCrashReasonForDialog(CExceptionInformation* pExceptionInformation)
332332
{
333333
if (pExceptionInformation == nullptr)
334334
{
@@ -528,7 +528,7 @@ static void AppendCrashDiagnostics(const SString& text)
528528
WriteDebugEvent(text.Replace("\n", " "));
529529
}
530530

531-
[[nodiscard]] static bool CaptureStackTraceText(_EXCEPTION_POINTERS* pException, SString& outText) noexcept
531+
[[nodiscard]] static bool CaptureStackTraceText(_EXCEPTION_POINTERS* pException, SString& outText)
532532
{
533533
if (pException == nullptr || pException->ContextRecord == nullptr)
534534
return false;
@@ -650,7 +650,7 @@ static void AppendCrashDiagnostics(const SString& text)
650650
return !outText.empty();
651651
}
652652

653-
static void AppendFallbackStackTrace(_EXCEPTION_POINTERS* pException) noexcept
653+
static void AppendFallbackStackTrace(_EXCEPTION_POINTERS* pException)
654654
{
655655
bool expected = false;
656656
if (!ms_bFallbackStackLogged.compare_exchange_strong(expected, true, std::memory_order_acquire, std::memory_order_relaxed))
@@ -668,7 +668,7 @@ static void AppendFallbackStackTrace(_EXCEPTION_POINTERS* pException) noexcept
668668
}
669669

670670
// Helper function to safely read callback exception context (uses SEH)
671-
static void TryLogCallbackContext(_EXCEPTION_POINTERS* pException) noexcept
671+
static void TryLogCallbackContext(_EXCEPTION_POINTERS* pException)
672672
{
673673
__try
674674
{
@@ -1177,7 +1177,7 @@ void CCrashDumpWriter::FreeMemoryForCrashDumpProcessing()
11771177
}
11781178

11791179
// Helper to safely read exception code using SEH
1180-
static DWORD SafeReadExceptionCode(_EXCEPTION_POINTERS* pException) noexcept
1180+
static DWORD SafeReadExceptionCode(_EXCEPTION_POINTERS* pException)
11811181
{
11821182
DWORD exceptionCode = 0;
11831183
__try
@@ -1199,7 +1199,7 @@ static DWORD SafeReadExceptionCode(_EXCEPTION_POINTERS* pException) noexcept
11991199
}
12001200

12011201
// Helper to get MTA path as C string for SEH contexts (avoids SString unwinding issues)
1202-
static const char* GetMTAPathForSEH() noexcept
1202+
static const char* GetMTAPathForSEH()
12031203
{
12041204
static char szPath[MAX_PATH] = {0};
12051205
static bool initialized = false;
@@ -1215,7 +1215,7 @@ static const char* GetMTAPathForSEH() noexcept
12151215
}
12161216

12171217
// Helper to write reentrant flag file using only SEH
1218-
static void TryWriteReentrantFlag(DWORD exceptionCode) noexcept
1218+
static void TryWriteReentrantFlag(DWORD exceptionCode)
12191219
{
12201220
// Use static buffer to avoid SString (which requires object unwinding)
12211221
static char szFlagPath[MAX_PATH];
@@ -1244,7 +1244,7 @@ static void TryWriteReentrantFlag(DWORD exceptionCode) noexcept
12441244
}
12451245

12461246
// Helper to re-read exception code with SEH protection (no C++ exception handling)
1247-
static DWORD SafeRereadExceptionCode(_EXCEPTION_POINTERS* pException, DWORD fallback) noexcept
1247+
static DWORD SafeRereadExceptionCode(_EXCEPTION_POINTERS* pException, DWORD fallback)
12481248
{
12491249
DWORD exceptionCode = fallback;
12501250
__try
@@ -1906,12 +1906,12 @@ void CCrashDumpWriter::DumpCoreLog(_EXCEPTION_POINTERS* pException, CExceptionIn
19061906
capturedFrames.reserve(lineCount);
19071907

19081908
std::transform(lines.cbegin(), lines.cend(), std::back_inserter(capturedFrames),
1909-
[](const auto& line) noexcept -> std::string {
1909+
[](const auto& line) -> std::string {
19101910
return std::string{line.c_str()};
19111911
});
19121912

19131913
const auto newEnd = std::remove_if(capturedFrames.begin(), capturedFrames.end(),
1914-
[](const auto& frame) noexcept -> bool {
1914+
[](const auto& frame) -> bool {
19151915
return frame.empty();
19161916
});
19171917
capturedFrames.erase(newEnd, capturedFrames.end());
@@ -1973,7 +1973,7 @@ void CCrashDumpWriter::DumpCoreLog(_EXCEPTION_POINTERS* pException, CExceptionIn
19731973

19741974
[[maybe_unused]] const auto allFramesValid =
19751975
std::all_of(frames.cbegin(), std::next(frames.cbegin(), static_cast<std::ptrdiff_t>(maxFrames)),
1976-
[](const auto& frame) constexpr noexcept -> bool { return !frame.empty(); });
1976+
[](const auto& frame) constexpr -> bool { return !frame.empty(); });
19771977

19781978
for (std::size_t i{}; i < maxFrames; ++i)
19791979
{

0 commit comments

Comments
 (0)