From 9a66c7c1b9e1488f54f6ecfaab714fdc2e770a7d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 16 May 2025 08:16:46 -0700 Subject: [PATCH] QTest::CrashHandler: move windowsFaultHandler() out of the class It accesses no members (there are none!), which further simplifies the header. Change-Id: Ic1251d8b56dc6cfeb136fffd7baf4d8bc7143750 Reviewed-by: Ahmad Samir Reviewed-by: Edward Welbourne --- src/testlib/qtestcrashhandler_p.h | 4 ---- src/testlib/qtestcrashhandler_win.cpp | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/testlib/qtestcrashhandler_p.h b/src/testlib/qtestcrashhandler_p.h index 29e80203288..d11ea964b58 100644 --- a/src/testlib/qtestcrashhandler_p.h +++ b/src/testlib/qtestcrashhandler_p.h @@ -30,7 +30,6 @@ #ifdef Q_OS_WIN #include -#include // for Sleep #endif QT_BEGIN_NAMESPACE @@ -88,9 +87,6 @@ namespace CrashHandler { { public: WindowsFaultHandler(); - - private: - static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo); }; using FatalSignalHandler = WindowsFaultHandler; #elif defined(Q_OS_UNIX) && !defined(Q_OS_WASM) diff --git a/src/testlib/qtestcrashhandler_win.cpp b/src/testlib/qtestcrashhandler_win.cpp index 8afb45e7b02..f814a6bc68e 100644 --- a/src/testlib/qtestcrashhandler_win.cpp +++ b/src/testlib/qtestcrashhandler_win.cpp @@ -16,6 +16,7 @@ #if !defined(Q_CC_MINGW) || (defined(Q_CC_MINGW) && defined(__MINGW64_VERSION_MAJOR)) # include #endif +#include QT_BEGIN_NAMESPACE @@ -168,6 +169,8 @@ DebugSymbolResolver::Symbol DebugSymbolResolver::resolveSymbol(DWORD64 address) } } // unnamed namespace +static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo); + WindowsFaultHandler::WindowsFaultHandler() { # if !defined(Q_CC_MINGW) @@ -177,7 +180,7 @@ WindowsFaultHandler::WindowsFaultHandler() SetUnhandledExceptionFilter(windowsFaultHandler); } -LONG WINAPI WindowsFaultHandler::windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo) +static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo) { enum { maxStackFrames = 100 }; char appName[MAX_PATH];