From b1936d3b0e64c073813e6159ebde8225390d9e06 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 2 Oct 2014 18:28:45 +0100 Subject: [PATCH] Calls method of FatalConditionHandler (to avoid warnings) --- include/internal/catch_fatal_condition.hpp | 14 +++++++++++--- include/internal/catch_runner_impl.hpp | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/internal/catch_fatal_condition.hpp b/include/internal/catch_fatal_condition.hpp index e87e9cfc..4433dfed 100644 --- a/include/internal/catch_fatal_condition.hpp +++ b/include/internal/catch_fatal_condition.hpp @@ -58,14 +58,22 @@ namespace Catch { fatal( "", -sig ); } - FatalConditionHandler() { + FatalConditionHandler() : m_isSet( true ) { for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) signal( signalDefs[i].id, handleSignal ); } ~FatalConditionHandler() { - for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) - signal( signalDefs[i].id, SIG_DFL ); + reset(); } + void reset() { + if( m_isSet ) { + for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) + signal( signalDefs[i].id, SIG_DFL ); + m_isSet = false; + } + } + + bool m_isSet; }; } // namespace Catch diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp index 7b9dcb66..8a65f26d 100644 --- a/include/internal/catch_runner_impl.hpp +++ b/include/internal/catch_runner_impl.hpp @@ -296,6 +296,7 @@ namespace Catch { void invokeActiveTestCase() { FatalConditionHandler fatalConditionHandler; // Handle signals m_activeTestCase->invoke(); + fatalConditionHandler.reset(); } private: