From 65ff731b62c2fa9ebc175471c55d49747f991b68 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 2 May 2022 18:27:11 -0700 Subject: [PATCH] FatalSignalHandler: use std::optional instead of QScopedPointer We get stack space reserved instead of using the heap. Pick-to: 6.3 Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb73fff0174150 Reviewed-by: Edward Welbourne --- src/testlib/qtestcase.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 8c40d111b8..b034ae9dd5 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1935,6 +1935,8 @@ public: } private: + Q_DISABLE_COPY_MOVE(FatalSignalHandler) + # ifdef SA_SIGINFO static void signal(int signum, siginfo_t * /* info */, void * /* ucontext */) # else @@ -2105,10 +2107,10 @@ int QTest::qRun() } else #endif { - QScopedPointer handler; + std::optional handler; prepareStackTrace(); if (!noCrashHandler) - handler.reset(new FatalSignalHandler); + handler.emplace(); TestMethods::MetaMethods commandLineMethods; commandLineMethods.reserve(static_cast(QTest::testFunctions.size()));