From faa50c08b17b6f9afad5179a17a4a45ab79049c1 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Wed, 22 Jul 2026 13:50:09 +0200 Subject: [PATCH 1/2] refactor: Run clang-format on qt test_main.cpp --- src/qt/test/test_main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index 5e91b0723ba..1a0f3c7b704 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -60,11 +60,11 @@ int main(int argc, char* argv[]) // Prefer the "minimal" platform for the test instead of the normal default // platform ("xcb", "windows", or "cocoa") so tests can't unintentionally // interfere with any background GUIs and don't require extra resources. - #if defined(WIN32) - if (getenv("QT_QPA_PLATFORM") == nullptr) _putenv_s("QT_QPA_PLATFORM", "minimal"); - #else - setenv("QT_QPA_PLATFORM", "minimal", 0 /* overwrite */); - #endif +#if defined(WIN32) + if (getenv("QT_QPA_PLATFORM") == nullptr) _putenv_s("QT_QPA_PLATFORM", "minimal"); +#else + setenv("QT_QPA_PLATFORM", "minimal", 0 /* overwrite */); +#endif QCoreApplication::setOrganizationName(QAPP_ORG_NAME); From fa0c8337a8d42564880715a07b00925d3e95dab1 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Wed, 22 Jul 2026 13:48:49 +0200 Subject: [PATCH 2/2] test: Nudge toward QT_STYLE_OVERRIDE=fusion on macOS Using the Fusion style works around QTBUG-49686. Otherwise, there could be a nullptr-deref under the QMacStyle. --- src/qt/test/test_main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index 1a0f3c7b704..62e132e802a 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -66,6 +66,12 @@ int main(int argc, char* argv[]) setenv("QT_QPA_PLATFORM", "minimal", 0 /* overwrite */); #endif +#ifdef Q_OS_MACOS + // QMacStyle assumes a Cocoa platform window, which the minimal platform + // does not provide. In particular, painting a QGroupBox can make Qt call + // addSubview: on an invalid native object (QTBUG-49686). + setenv("QT_STYLE_OVERRIDE", "fusion", 0 /* overwrite */); +#endif QCoreApplication::setOrganizationName(QAPP_ORG_NAME); QCoreApplication::setApplicationName(QAPP_APP_NAME_DEFAULT "-test");