diff options
| author | Eric Beuque <eric.beuque@gmail.com> | 2025-02-17 17:45:51 +0100 |
|---|---|---|
| committer | Eric Beuque <eric.beuque@gmail.com> | 2025-02-19 19:13:58 +0100 |
| commit | 50d1a22e5c6361e7c1ef09432b2a151eee3e6114 (patch) | |
| tree | 9423b8fb4c7e14634151de9e7efebe1d5394c2f7 /src/testlib/qtestcrashhandler.cpp | |
| parent | c3d2a4972ca6bec5bfe9dbe989e2dc6e347f02c1 (diff) | |
Fix bad signal restoration which can cause infinite loop
This fix the FatalSignalHandler destructor to restore properly the
signal handler which cause an infinite loop when a signal is emitted
like SIGABRT or SIGINT and when we are using two QTest object in same
program.
Fixes: QTBUG-132121
Pick-to: 6.9 6.8 6.5
Change-Id: Ie9476e1ff9c0f29c3e35ae6dff565fab4a77ba86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/testlib/qtestcrashhandler.cpp')
| -rw-r--r-- | src/testlib/qtestcrashhandler.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/testlib/qtestcrashhandler.cpp b/src/testlib/qtestcrashhandler.cpp index c2a10dedf64..a9a8b37884a 100644 --- a/src/testlib/qtestcrashhandler.cpp +++ b/src/testlib/qtestcrashhandler.cpp @@ -548,10 +548,10 @@ FatalSignalHandler::~FatalSignalHandler() for (size_t i = 0; i < fatalSignals.size(); ++i) { struct sigaction &act = oldActions()[i]; - if (act.sa_flags == 0 && act.sa_handler == SIG_DFL) - continue; // Already the default if (sigaction(fatalSignals[i], nullptr, &action)) continue; // Failed to query present handler + if (action.sa_flags == 0 && action.sa_handler == SIG_DFL) + continue; // Already the default if (isOurs(action)) sigaction(fatalSignals[i], &act, nullptr); } |
