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 <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Thiago Macieira 2025-05-16 08:16:46 -07:00
parent fc7c5c0a2b
commit 9a66c7c1b9
2 changed files with 4 additions and 5 deletions

View File

@ -30,7 +30,6 @@
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <iostream> #include <iostream>
#include <qt_windows.h> // for Sleep
#endif #endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -88,9 +87,6 @@ namespace CrashHandler {
{ {
public: public:
WindowsFaultHandler(); WindowsFaultHandler();
private:
static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo);
}; };
using FatalSignalHandler = WindowsFaultHandler; using FatalSignalHandler = WindowsFaultHandler;
#elif defined(Q_OS_UNIX) && !defined(Q_OS_WASM) #elif defined(Q_OS_UNIX) && !defined(Q_OS_WASM)

View File

@ -16,6 +16,7 @@
#if !defined(Q_CC_MINGW) || (defined(Q_CC_MINGW) && defined(__MINGW64_VERSION_MAJOR)) #if !defined(Q_CC_MINGW) || (defined(Q_CC_MINGW) && defined(__MINGW64_VERSION_MAJOR))
# include <crtdbg.h> # include <crtdbg.h>
#endif #endif
#include <qt_windows.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -168,6 +169,8 @@ DebugSymbolResolver::Symbol DebugSymbolResolver::resolveSymbol(DWORD64 address)
} }
} // unnamed namespace } // unnamed namespace
static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo);
WindowsFaultHandler::WindowsFaultHandler() WindowsFaultHandler::WindowsFaultHandler()
{ {
# if !defined(Q_CC_MINGW) # if !defined(Q_CC_MINGW)
@ -177,7 +180,7 @@ WindowsFaultHandler::WindowsFaultHandler()
SetUnhandledExceptionFilter(windowsFaultHandler); SetUnhandledExceptionFilter(windowsFaultHandler);
} }
LONG WINAPI WindowsFaultHandler::windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo) static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo)
{ {
enum { maxStackFrames = 100 }; enum { maxStackFrames = 100 };
char appName[MAX_PATH]; char appName[MAX_PATH];