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 <edward.welbourne@qt.io>
This commit is contained in:
Thiago Macieira 2022-05-02 18:27:11 -07:00
parent 3bd1aa09b6
commit 65ff731b62

View File

@ -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<FatalSignalHandler> handler;
std::optional<FatalSignalHandler> handler;
prepareStackTrace();
if (!noCrashHandler)
handler.reset(new FatalSignalHandler);
handler.emplace();
TestMethods::MetaMethods commandLineMethods;
commandLineMethods.reserve(static_cast<size_t>(QTest::testFunctions.size()));