Calls method of FatalConditionHandler (to avoid warnings)

This commit is contained in:
Phil Nash 2014-10-02 18:28:45 +01:00
parent 8ec9a5a547
commit b1936d3b0e
2 changed files with 12 additions and 3 deletions

View File

@ -58,14 +58,22 @@ namespace Catch {
fatal( "<unknown signal>", -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

View File

@ -296,6 +296,7 @@ namespace Catch {
void invokeActiveTestCase() {
FatalConditionHandler fatalConditionHandler; // Handle signals
m_activeTestCase->invoke();
fatalConditionHandler.reset();
}
private: